vladkens / twscrape

2024! Twitter API scrapper with authorization support. Allows you to scrape search results, User's profiles (followers/following), Tweets (favoriters/retweeters) and more.
https://pypi.org/project/twscrape/
MIT License
784 stars 102 forks source link

No account available for queue "SearchTimeline" again #189

Closed Alexandros11 closed 1 month ago

Alexandros11 commented 1 month ago

I tried followed code:

import asyncio
from twscrape import API

async def main():
    api = API()
    await api.pool.add_account("ACC1", "acc1pass", "ACC1@gmail.com", "acc1pass")
    await api.pool.relogin("ACC1")

    q = "elon musk since:2023-01-01 until:2023-05-31"
    async for tweet in api.search(q, limit=5000):
        print(tweet.id, tweet.user.username, tweet.rawContent)

await main()

I got result:

2024-05-13 14:04:49.447 | WARNING  | twscrape.accounts_pool:add_account:88 - Account ACC1 already exists
2024-05-13 14:04:49.486 | INFO     | twscrape.accounts_pool:login_all:183 - [1/1] Logging in ACC1 - hanhambro77@interia.pl
2024-05-13 14:04:51.555 | INFO     | twscrape.accounts_pool:login:158 - Logged in to ACC1 successfully
2024-05-13 14:04:52.017 | INFO     | twscrape.accounts_pool:get_for_queue_or_wait:301 - No account available for queue "SearchTimeline". Next available at 14:16:35

Whats wrong here?

LucasLeRay commented 1 month ago

As far as I can tell, nothing is wrong. twscrape uses your account to scrape Twitter until a certain limit is reached. When this limit is reached, twscrape will wait 15m, and process where it stopped.

You are trying to fetch 5000 tweets, which is beyond the limit. So twscrape gets your tweets, wait 15m when it reached the limit, and resume just after.

Alexandros11 commented 1 month ago

You are right it works!. This package is great but could use a better tutorial. When I ran this code for the first time I was sure something went wrong.