steevenakintilo / TwitterGiveawayBot

A bot that make you participate to any twitter giveaway
Apache License 2.0
18 stars 3 forks source link

Snscrape Get Items Error #4

Closed Rana-0003 closed 1 year ago

Rana-0003 commented 1 year ago

Everything was working fine then suddenly a unknown snscrape error occured.

Traceback (most recent call last): File "f:\TwitterGiveawayBot-main\get_tweet.py", line 258, in search_giveaway for i,tweet in enumerate(sntwitter.TwitterSearchScraper(text).get_items()): File "C:\Program Files\Python311\Lib\site-packages\snscrape\modules\twitter.py", line 1763, in get_items for obj in self._iter_api_data('https://twitter.com/i/api/graphql/7jT5GT59P8IFjgxwqnEdQw/SearchTimeline', _TwitterAPIType.GRAPHQL, params, paginationParams, cursor = self._cursor, instructionsPath = ['data', 'search_by_raw_query', 'search_timeline', 'timeline', 'instructions']): File "C:\Program Files\Python311\Lib\site-packages\snscrape\modules\twitter.py", line 915, in _iter_api_data obj = self._get_api_data(endpoint, apiType, reqParams, instructionsPath = instructionsPath) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\snscrape\modules\twitter.py", line 886, in _get_api_data r = self._get(endpoint, params = params, headers = self._apiHeaders, responseOkCallback = functools.partial(self._check_api_response, apiType = apiType, instructionsPath = instructionsPath)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\snscrape\base.py", line 275, in _get return self._request('GET', *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\site-packages\snscrape\base.py", line 271, in _request raise ScraperException(msg) snscrape.base.ScraperException: 4 requests to https://twitter.com/i/api/graphql/7jT5GT59P8IFjgxwqnEdQw/SearchTimeline?variables=%7B%22rawQuery%22%3A%221x%20nft%20giveaway%20rt%20lang%3Aen%22%2C%22count%22%3A20%2C%22product%22%3A%22Latest%22%2C%22withDownvotePerspective%22%3Afalse%2C%22withReactionsMetadata%22%3Afalse%2C%22withReactionsPerspective%22%3Afalse%7D&features=%7B%22rweb_lists_timeline_redesign_enabled%22%3Afalse%2C%22blue_business_profile_image_shape_enabled%22%3Afalse%2C%22responsive_web_graphql_exclude_directive_enabled%22%3Atrue%2C%22verified_phone_label_enabled%22%3Afalse%2C%22creator_subscriptions_tweet_preview_api_enabled%22%3Afalse%2C%22responsive_web_graphql_timeline_navigation_enabled%22%3Atrue%2C%22responsive_web_graphql_skip_user_profile_image_extensions_enabled%22%3Afalse%2C%22tweetypie_unmention_optimization_enabled%22%3Atrue%2C%22vibe_api_enabled%22%3Atrue%2C%22responsive_web_edit_tweet_api_enabled%22%3Atrue%2C%22graphql_is_translatable_rweb_tweet_is_translatable_enabled%22%3Atrue%2C%22view_counts_everywhere_api_enabled%22%3Atrue%2C%22longform_notetweets_consumption_enabled%22%3Atrue%2C%22tweet_awards_web_tipping_enabled%22%3Afalse%2C%22freedom_of_speech_not_reach_fetch_enabled%22%3Afalse%2C%22standardized_nudges_misinfo%22%3Atrue%2C%22tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled%22%3Afalse%2C%22interactive_text_enabled%22%3Atrue%2C%22responsive_web_text_conversations_enabled%22%3Afalse%2C%22longform_notetweets_rich_text_read_enabled%22%3Afalse%2C%22longform_notetweets_inline_media_enabled%22%3Afalse%2C%22responsive_web_enhance_cards_enabled%22%3Afalse%2C%22responsive_web_twitter_blue_verified_badge_is_enabled%22%3Atrue%7D failed, giving up.

steevenakintilo commented 1 year ago

Hello I've already had myself this error it's from snscrape and happends sometimes (but if it always happend for days tell me) so you can just wait

steevenakintilo commented 1 year ago

Or find giveaway yourself and add them to the recent_url.txt file and set the crash_or_true to true

Rana-0003 commented 1 year ago

As Elon stopped data scrapping. So is there no way to make this bot works??

Some people trying other methods. Does it work??

from snscrape.modules.twitter import TwitterSearchScraper maxTweets = 10 tweets_list = []
for i,tweet in enumerate(TwitterSearchScraper('elon musk').get_items()):
if i>maxTweets: break tweets_list.append({ "date": tweet.date, "id":tweet.id, "content":tweet.content, "username":tweet.user.username })

steevenakintilo commented 1 year ago

Hello for the moment snscrape is "down' but I hope it will work again so the only solution is to find the giveaway yourself and add them to the recent_url.txt files and it will work fine