This repository has been archived by the owner on Mar 1, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check key "document" exists before parsing
Check if the key "document" key exists on message['media'] before parsing, otherwise script fails To reproduce configure CERT-PA channel @certpaitalia; they usually don't attach files to the news. Launch the script and you see following error gmellini@19-04:~/Scrivania/OpenSource/DL-Telegram-by-file-attachment$ ./downloader.py DL-Telegram-by-file-attachment started... Config loaded! Traceback (most recent call last): File "./downloader.py", line 40, in <module> if 'webpage' in message['media'] and re.search(term, message['media']['document']['attributes'][0]['file_name'], re.IGNORECASE): KeyError: 'document' gmellini@19-04:~/Scrivania/OpenSource/DL-Telegram-by-file-attachment$ With the fix is ok
- Loading branch information