Guest token

Twitter did not return a guest token.

The error#

Unable to retrieve guest token

ScraperException is raised when guest/activate.json returns JSON without a guest_token field. The same function logs Retrieving guest token and, if the HTML and cookies had no gt value, Retrieving guest token via API.

A non-200 response on that call is not this sentence. _check_guest_token_response returns the reason blocked ({status}) when the status is 404, and non-200 response ({status}) otherwise. After retries, that becomes the giving-up error.

What triggers it#

_ensure_guest_token found no gt cookie and no gt= assignment in the HTML, then the activate endpoint's JSON had no guest_token.

How to confirm#

The exception text is exactly Unable to retrieve guest token. A message that contains blocked ( is the next page, not this one.

Fixes#

This version has no login argument on the guest-token path. It only knows the anonymous guest token. When Twitter stops issuing one, the same call keeps failing. There is no flag in _ensure_guest_token that switches to a user session.

SocialScrape#

Profile is GET /v1/twitter/profile. One post is GET /v1/twitter/tweet. A profile's posts are GET /v1/twitter/profile/tweets. These read what X shows logged out.

Failed requests cost 0 credits. New accounts get 100 credits on signup, no card. Suspended accounts come back as removed, unknown ones as not_found.

Questions

Does SocialScrape use a guest token?

No. Profile and post reads use the logged-out X pages.

Which snscrape version is this?

0.7.0.20230622.