bisguzar / twitter-scraper

Scrape the Twitter Frontend API without authentication.
MIT License
3.94k stars 603 forks source link

Tweets with videos error out looking for index(".jpg") #35

Open BenQuigley opened 6 years ago

BenQuigley commented 6 years ago

Example usage:

for t in get_tweets(twitter, pages=n):
    ...

Error:

Getting 4 tweets from ggreenwald
Traceback (most recent call last):
  File "bot.py", line 37, in <module>
    main()
  File "bot.py", line 24, in main
    tweets = combine_tweets()
  File "bot.py", line 14, in combine_tweets
    for t in get_tweets(twitter, pages=n):
  File "/home/ben/local/bot/env/lib/python3.6/site-packages/twitter_scraper.py", line 78, in get_tweets
    yield from gen_tweets(pages)
  File "/home/ben/local/bot/env/lib/python3.6/site-packages/twitter_scraper.py", line 57, in gen_tweets
    video_id = tmp[:tmp.index('.jpg')]
ValueError: substring not found
BenQuigley commented 6 years ago

Pull request to fix: https://github.com/kennethreitz/twitter-scraper/pull/36