Skip to content
Permalink
Browse files

channel lowercase or doesn't work

  • Loading branch information...
Mte90 committed Aug 22, 2019
1 parent 203d84f commit 149d2d2a281d6b078ee3a95fa80f61327679a2d1
Showing with 3 additions and 2 deletions.
  1. +3 −2 downloader.py
@@ -26,7 +26,8 @@
print('Config file not found')
exit()

url = 'https://tg.i-c-a.su/json/' + config.get('channel', 'name') + '?limit=' + config.get('channel', 'limit')
channel_name = str(config.get('channel', 'name')).lower()
url = 'https://tg.i-c-a.su/json/' + channel_name + '?limit=' + config.get('channel', 'limit')
r = urlopen(url)
data = json.loads(str(r.read().decode("utf-8")))

@@ -38,7 +39,7 @@
for term in search:
if 'document' in message['media'] and re.search(term, message['media']['document']['attributes'][0]['file_name'], re.IGNORECASE):
print(' Download ' + message['media']['document']['attributes'][0]['file_name'])
response = urlopen('https://tg.i-c-a.su/media/' + config.get('channel', 'name') + '/' + str(message['id']))
response = urlopen('https://tg.i-c-a.su/media/' + channel_name + '/' + str(message['id']))
file = open(config.get('channel', 'download') + message['media']['document']['attributes'][0]['file_name'], 'wb')
file.write(response.read())
file.close

0 comments on commit 149d2d2

Please sign in to comment.
You can’t perform that action at this time.