forked from varia/bots
updating the download path
This commit is contained in:
parent
1accd7d1c1
commit
192dbbc2a7
@ -53,9 +53,9 @@ def download(message):
|
|||||||
parsed_url = urlparse(message.url)
|
parsed_url = urlparse(message.url)
|
||||||
filename = os.path.basename(parsed_url.path).replace(' ','_').replace('%20','_') # safe url's
|
filename = os.path.basename(parsed_url.path).replace(' ','_').replace('%20','_') # safe url's
|
||||||
print('as the file: ', filename)
|
print('as the file: ', filename)
|
||||||
if not os.path.isdir(f'{ message.room }/{ media_type }'):
|
if not os.path.isdir(f'{ output }/{ message.room }/{ media_type }'):
|
||||||
os.mkdir(f'{ message.room }/{ media_type }')
|
os.mkdir(f'{ output }/{ message.room }/{ media_type }')
|
||||||
with open(f'{ message.room }/{ media_type }/{ filename }', 'wb') as media_file:
|
with open(f'{ output }/{ message.room }/{ media_type }/{ filename }', 'wb') as media_file:
|
||||||
media_file.write(data)
|
media_file.write(data)
|
||||||
media_file.close()
|
media_file.close()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user