taspinar / twitterscraper

Scrape Twitter for Tweets
MIT License
2.4k stars 578 forks source link

AttributeError: 'NoneType' object has no attribute 'find_all' #295

Open wongpenghong opened 4 years ago

wongpenghong commented 4 years ago

when i run on version twitterscraper==1.4.0 , popup some error

lapp0 commented 4 years ago

Please post your full traceback and command.

javad94 commented 4 years ago

I have this issue too. traceback:

INFO: {'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 6.1; x64; fr; rv:1.9.2.13) Gecko/20101203 Firebird/3.6.13'}
Traceback (most recent call last):
  File "/share/python_scripts/twitterbotsearch.py", line 1, in <module>
    from twitterscraper import query_tweets
  File "/home/pi/.local/lib/python3.6/site-packages/twitterscraper/__init__.py", line 13, in <module>
    from twitterscraper.query import query_tweets
  File "/home/pi/.local/lib/python3.6/site-packages/twitterscraper/query.py", line 73, in <module>
    proxies = get_proxies()
  File "/home/pi/.local/lib/python3.6/site-packages/twitterscraper/query.py", line 46, in get_proxies
    list_tr = table.find_all('tr')
AttributeError: 'NoneType' object has no attribute 'find_all'
zhicheng0501 commented 4 years ago

I have this issue too. traceback:

INFO: {'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 6.1; x64; fr; rv:1.9.2.13) Gecko/20101203 Firebird/3.6.13'}
Traceback (most recent call last):
  File "/share/python_scripts/twitterbotsearch.py", line 1, in <module>
    from twitterscraper import query_tweets
  File "/home/pi/.local/lib/python3.6/site-packages/twitterscraper/__init__.py", line 13, in <module>
    from twitterscraper.query import query_tweets
  File "/home/pi/.local/lib/python3.6/site-packages/twitterscraper/query.py", line 73, in <module>
    proxies = get_proxies()
  File "/home/pi/.local/lib/python3.6/site-packages/twitterscraper/query.py", line 46, in get_proxies
    list_tr = table.find_all('tr')
AttributeError: 'NoneType' object has no attribute 'find_all'

It is very likely to be caused by the empty list scraped from the proxy website.when the problem occurs, table should be empty. In this case, find_all method is not able to get anything from table. you could wait for a moment and retry it. It should be back to normal very soon.

lapp0 commented 4 years ago

What command are you running to get this traceback?

javad94 commented 4 years ago

What command are you running to get this traceback?

torsocks twitterscraper Trump -l 1000

qreodium commented 3 years ago

In query.py need change table = soup.find('table',id='proxylisttable') to table = soup.find('table', {"class": 'table'}) because they change proxy site

seaona commented 3 years ago

Hi! I've changed the query.py as mentioned above, but I still don't succeed on solving the error. Any thoughts? My query was just running the example script:

examples/get_twitter_user_data.py

image