Created
August 27, 2018 23:42
-
-
Save StrikingLoo/5268541dbd29ce25b239cf80df90cae2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def ascii_encode(img_url): | |
| return unicodedata.normalize('NFKD', img_url).encode('ascii','ignore') | |
| def download_pictures(self, response): | |
| image_urls = get_image_urls(response) | |
| for img_url in image_urls: | |
| self.index+=1 | |
| print(img_url) | |
| ascii_url = ascii_encode(img_url) | |
| img_data = requests.get(ascii_url).content | |
| with open(str(self.index)+".jpg", 'w') as handler: | |
| handler.write(img_data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment