okainov / ebay-kleinanzeigen

Telegram bot notifying about new ads on Ebay-Kleinanzeigen.de
64 stars 19 forks source link

Adapt to updated security mechanisms #2

Closed muety closed 2 years ago

muety commented 3 years ago

Looks like Ebay Kleinanzeigen has changed their site to return a 403 Forbidden for requests like the ones made by this bot.

2021-01-24 20:08:51,909 [INFO] Started echo
2021-01-24 20:08:51,996 [INFO] Added job "echo" to job store "default"
2021-01-24 20:08:51,997 [INFO] Scheduled job
Update "%s" caused error "%s" {'update_id': 894274138, 'message': {'message_id': 1890, 'date': 1611515331, 'chat': {'id': 1234567, 'type': 'private', 'username': 'n1try', 'first_name': 'Ferdinand'}, 'text': 'https://www.ebay-kleinanzeigen.de/s-suchanfrage.html?keywords=macbook&categoryId=&locationStr=76137+Karlsruhe&locationId=9192&radius=0&sortingField=SORTING_DATE&adType=&posterType=&pageNum=1&action=find&maxPrice=&minPrice=', 'entities': [{'type': 'url', 'offset': 0, 'length': 222}], 'caption_entities': [], 'photo': [], 'new_chat_members': [], 'new_chat_photo': [], 'delete_chat_photo': False, 'group_chat_created': False, 'supergroup_chat_created': False, 'channel_chat_created': False, 'from': {'id': 1234567, 'first_name': 'Ferdinand', 'is_bot': False, 'username': 'n1try', 'language_code': 'en'}}, '_effective_user': {'id': 32850066, 'first_name': 'Ferdinand', 'is_bot': False, 'username': 'n1try', 'language_code': 'en'}, '_effective_chat': {'id': 1234567, 'type': 'private', 'username': 'n1try', 'first_name': 'Ferdinand'}, '_effective_message': {'message_id': 1890, 'date': 1611515331, 'chat': {'id': 1234567, 'type': 'private', 'username': 'n1try', 'first_name': 'Ferdinand'}, 'text': 'https://www.ebay-kleinanzeigen.de/s-suchanfrage.html?keywords=macbook&categoryId=&locationStr=76137+Karlsruhe&locationId=9192&radius=0&sortingField=SORTING_DATE&adType=&posterType=&pageNum=1&action=find&maxPrice=&minPrice=', 'entities': [{'type': 'url', 'offset': 0, 'length': 222}], 'caption_entities': [], 'photo': [], 'new_chat_members': [], 'new_chat_photo': [], 'delete_chat_photo': False, 'group_chat_created': False, 'supergroup_chat_created': False, 'channel_chat_created': False, 'from': {'id': 1234567, 'first_name': 'Ferdinand', 'is_bot': False, 'username': 'n1try', 'language_code': 'en'}}} list index out of range

I assume that you will have to include the cookies set by the first request when performing the second one to follow the redirect.

okainov commented 2 years ago

Seems should be better now with #6 merged. Please let me know iа there are any issues.