-
-
Save kagermanov27/9e162f06884a881f7b24926625ac1396 to your computer and use it in GitHub Desktop.
This file contains 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
## Download and guess the file format | |
r = requests.get(link) | |
extension = mimetypes.guess_extension(r.headers.get('content-type', '').split(';')[0]) | |
if not extension == ".html": | |
with open("datasets/test/{}/{}.{}".format(self.query.q, latest_file_name, extension or 'jpg'), 'wb') as f: | |
f.write(r.content) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment