I use THIS code for docker bot testing but I get this error: Could not find the dlcdownload element
Could not find the dlcdownload element.2024-04-01 00:20:12,268 - werkzeug - INFO - 127.0.0.1 - - [01/Apr/2024 00:20:12] "GET /test/filecrypt.cc/Container/F21C754A83.html HTTP/1.1" 200 -2024-04-01 00:20:35,966 - telegram.bot - DEBUG - Entering: get_me2024-04-01 00:20:35,975 - telegram.bot - DEBUG - {'can_read_all_group_messages': False, 'supports_inline_queries': False, 'username': 'filecyptsoffitta_bot', 'is_bot': True, 'can_join_groups': True, 'id': 7062873875, 'first_name': 'filecrypt'}2024-04-01 00:20:35,975 - telegram.bot - DEBUG - Exiting: get_me2024-04-01 00:20:35,975 - telegram.bot - DEBUG - Entering: send_message2024-04-01 00:20:36,014 - telegram.bot - DEBUG - {'entities': [{'offset': 31, 'length': 5, 'type': 'bot_command'}], 'caption_entities': [], 'delete_chat_photo': False, 'chat': {'username': 'Peter_****', 'first_name': 'Peter', 'type': 'private', 'id': 12*****}, 'text': 'Inserisci un URL FileCrypt con /link <url>', 'new_chat_members': [], 'photo': [], 'date': 1711930835, 'message_id': 58, 'new_chat_photo': [], 'channel_chat_created': False, 'supergroup_chat_created': False, 'group_chat_created': False, 'from': {'username': 'filecypt******_bot', 'is_bot': True, 'id': 70******, 'first_name': 'filecrypt'}}2024-04-01 00:20:36,014 - telegram.bot - DEBUG - Exiting: send_message2024-04-01 00:20:36,014 - werkzeug - INFO - 127.0.0.1 - - [01/Apr/2024 00:20:36] "POST /7062873875:AAGSeNq_0sKu5psGLEKwcFyRTCqYy_9LZ6g HTTP/1.1" 200 -2024-04-01 00:20:41,086 - root - DEBUG - Processing https://filecrypt.cc/Container/F21C754A83.html...2024-04-01 00:20:41,087 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): filecrypt.cc:4432024-04-01 00:20:41,461 - urllib3.connectionpool - DEBUG - https://filecrypt.cc:443 "GET /Container/F21C754A83.html HTTP/1.1" 200 NoneCould not find the dlcdownload element.2024-04-01 00:20:41,467 - werkzeug - INFO - 127.0.0.1 - - [01/Apr/2024 00:20:41] "POST /7062873875:AAGSeNq_0sKu5psGLEKwcFyRTCqYy_9LZ6g HTTP/1.1" 200 -
This is strange because I I don't get this error in this standalone code running from terminal (locally) and I get urls from filecrypt links without problems but it fails when runs inside a Docker container.
https://imgur.com/F1IuRpd.png
I test this url: https://filecrypt.cc/Container/F21C754A83.html
import requestsfrom bs4 import BeautifulSoupimport jsondef get_links(filecrypt_url): response = requests.get(filecrypt_url) soup = BeautifulSoup(response.text, 'html.parser') if "/Link/" in filecrypt_url: script = soup.find_all('script')[-1].string start = script.rfind('http') end = script.find('id=', start) + 43 link = script[start:end].replace('&', '&') return [link] elif "/Container/" in filecrypt_url: dlcdownload_element = soup.find('button', class_='dlcdownload') if dlcdownload_element is None: print("Could not find the dlcdownload element.") return [] dlc_id = dlcdownload_element['onclick'].split("'")[1] dlc_url = f"https://{filecrypt_url.split('/')[2]}/DLC/{dlc_id}.dlc" dlc_response = requests.get(dlc_url) dcrypt_url = "http://dcrypt.it/decrypt/paste" dcrypt_data = {"content": dlc_response.text} dcrypt_response = requests.post(dcrypt_url, data=dcrypt_data) dcrypt_json = json.loads(dcrypt_response.text) return dcrypt_json['success']['links']def main(): print("Enter FileCrypt URLs (one per line, end with an empty line):") filecrypt_urls = [] while True: line = input() if line: filecrypt_urls.append(line) else: break for filecrypt_url in filecrypt_urls: print(f"Processing {filecrypt_url}...") links = get_links(filecrypt_url) for link in links: print(link) print()main()if __name__ == "__main__": main()