Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gzip pages decompressor added #44

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mahdi-saberi
Copy link

some websites have gzip enabled on their webservers!
e.g.
http://www.yjc.ir/fa/news/6072181/

so we need to have gzip decompressor

@@ -42,6 +42,16 @@ def __init__(self, extractor='DefaultExtractor', **kwargs):
if encoding.lower() == 'text/html':
encoding = chardet.detect(self.data)['encoding']
try:
import gzip
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gzip should only be invoked when we are sure that the data is actually compressed. You may want to check an appropriate header.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nowadays lots and lots of websites are gzip
i added exception "pass" if it's not

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants