JustAnotherArchivist / snscrape

A social networking service scraper in Python
GNU General Public License v3.0
4.42k stars 706 forks source link

Twitter Trends #1006

Closed adamnovrisal closed 1 year ago

adamnovrisal commented 1 year ago

Hello, I just curious about twitter trends. Why snscrape still scrape about that? bcs, I can't go to https://twitter.com/i/trends without login. Thanks

JustAnotherArchivist commented 1 year ago

Because the internal API endpoint isn't locked down, only the web page.

ozmydas commented 1 year ago

Because the internal API endpoint isn't locked down, only the web page.

hi.. is trends still work?

i got error when executing

scraper = sntwitter.TwitterTrendsScraper()

for trend in scraper.get_items(): print(trend.json())

INFO:snscrape.modules.twitter:Retrieving guest token
INFO:snscrape.base:Retrieving https://twitter.com/i/trends
INFO:snscrape.base:Retrieved https://twitter.com/i/trends (redirected to https://twitter.com/i/flow/login?redirect_after_login=%2Fi%2Ftrends): 200
INFO:snscrape.modules.twitter:Retrieving guest token via API
INFO:snscrape.base:Retrieving https://api.twitter.com/1.1/guest/activate.json
INFO:snscrape.base:Retrieved https://api.twitter.com/1.1/guest/activate.json: 200
ERROR:snscrape.base:Error retrieving https://twitter.com/i/api/2/guide.json?include_profile_interstitial_type=1&include_blocking=1&include_blocked_by=1&include_followed_by=1&include_want_retweets=1&include_mute_edge=1&include_can_dm=1&include_can_media_tag=1&include_ext_has_nft_avatar=1&skip_status=1&cards_platform=Web-12&include_cards=1&include_ext_alt_text=true&include_quote_count=true&include_reply_count=1&tweet_mode=extended&include_entities=true&include_user_entities=true&include_ext_media_color=true&include_ext_media_availability=true&include_ext_sensitive_media_warning=true&include_ext_trusted_friends_metadata=true&send_error_codes=true&simple_quoted_tweet=true&count=20&candidate_source=trends&include_page_configuration=false&entity_tokens=false&ext=mediaStats%2ChighlightedLabel%2ChasNftAvatar%2CvoiceInfo%2Cenrichments%2CsuperFollowMetadata%2CunmentionInfo: blocked (404)
CRITICAL:snscrape.base:4 requests to https://twitter.com/i/api/2/guide.json?include_profile_interstitial_type=1&include_blocking=1&include_blocked_by=1&include_followed_by=1&include_want_retweets=1&include_mute_edge=1&include_can_dm=1&include_can_media_tag=1&include_ext_has_nft_avatar=1&skip_status=1&cards_platform=Web-12&include_cards=1&include_ext_alt_text=true&include_quote_count=true&include_reply_count=1&tweet_mode=extended&include_entities=true&include_user_entities=true&include_ext_media_color=true&include_ext_media_availability=true&include_ext_sensitive_media_warning=true&include_ext_trusted_friends_metadata=true&send_error_codes=true&simple_quoted_tweet=true&count=20&candidate_source=trends&include_page_configuration=false&entity_tokens=false&ext=mediaStats%2ChighlightedLabel%2ChasNftAvatar%2CvoiceInfo%2Cenrichments%2CsuperFollowMetadata%2CunmentionInfo failed, giving up.
CRITICAL:snscrape.base:Errors: blocked (404), blocked (404), blocked (404), blocked (404)
JustAnotherArchivist commented 1 year ago

Apparently not, but that would be an extension to #996.

I'll consider the question here answered, although I seem to have forgotten to close the issue at the time.