|
|
@ -53,9 +53,9 @@ def download(message): |
|
|
|
parsed_url = urlparse(message.url) |
|
|
|
filename = os.path.basename(parsed_url.path).replace(' ','_').replace('%20','_') # safe url's |
|
|
|
print('as the file: ', filename) |
|
|
|
if not os.path.isdir(f'{ message.room }/{ media_type }'): |
|
|
|
os.mkdir(f'{ message.room }/{ media_type }') |
|
|
|
with open(f'{ message.room }/{ media_type }/{ filename }', 'wb') as media_file: |
|
|
|
if not os.path.isdir(f'{ output }/{ message.room }/{ media_type }'): |
|
|
|
os.mkdir(f'{ output }/{ message.room }/{ media_type }') |
|
|
|
with open(f'{ output }/{ message.room }/{ media_type }/{ filename }', 'wb') as media_file: |
|
|
|
media_file.write(data) |
|
|
|
media_file.close() |
|
|
|
|
|
|
|