taspinar / twitterscraper

Scrape Twitter for Tweets
MIT License
2.39k stars 581 forks source link

Not working due to : AttributeError: 'NoneType' object has no attribute 'find_all' #366

Open steeley opened 2 years ago

steeley commented 2 years ago

Python 3.9.7 osx Big sur.

twitterscraper Trump --limit 1000 --output=tweets.json

Traceback (most recent call last): File "/usr/local/bin/twitterscraper", line 33, in sys.exit(load_entry_point('twitterscraper==1.6.1', 'console_scripts', 'twitterscraper')()) File "/usr/local/bin/twitterscraper", line 25, in importlib_load_entry_point return next(matches).load() File "/usr/local/Cellar/python@3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/metadata.py", line 77, in load module = import_module(match.group('module')) File "/usr/local/Cellar/python@3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1030, in _gcd_import File "", line 1007, in _find_and_load File "", line 972, in _find_and_load_unlocked File "", line 228, in _call_with_frames_removed File "", line 1030, in _gcd_import File "", line 1007, in _find_and_load File "", line 986, in _find_and_load_unlocked File "", line 664, in _load_unlocked File "", line 627, in _load_backward_compatible File "", line 259, in load_module File "/usr/local/lib/python3.9/site-packages/twitterscraper-1.6.1-py3.9.egg/twitterscraper/init.py", line 13, in File "", line 1007, in _find_and_load File "", line 986, in _find_and_load_unlocked File "", line 664, in _load_unlocked File "", line 627, in _load_backward_compatible File "", line 259, in load_module File "/usr/local/lib/python3.9/site-packages/twitterscraper-1.6.1-py3.9.egg/twitterscraper/query.py", line 76, in File "/usr/local/lib/python3.9/site-packages/twitterscraper-1.6.1-py3.9.egg/twitterscraper/query.py", line 49, in get_proxies AttributeError: 'NoneType' object has no attribute 'find_all'

MonikaBarget commented 2 years ago

I have the exact same problem.

I did not look at the Twitter source code yet, but it may be that they have constructed their tables differently now. The error clearly occurs when BeautifulSoup is trying to read a HTML table:

C:\ProgramData\Anaconda3\lib\site-packages\twitterscraper\query.py in get_proxies()
     47     soup = BeautifulSoup(response.text, 'lxml')
     48     table = soup.find('table',id='proxylisttable')
---> 49     list_tr = table.find_all('tr')
     50     list_td = [elem.find_all('td') for elem in list_tr]
     51     list_td = list(filter(None, list_td))

AttributeError: 'NoneType' object has no attribute 'find_all'
jankozuchowski commented 2 years ago

I fixed it with changing 48th line to: table = soup.find('table',{'class': 'table table-striped table-bordered'})

hinceme commented 2 years ago

I fixed it with changing 48th line to: table = soup.find('table',{'class': 'table table-striped table-bordered'})

Hi there, I tried this and I am still getting the same error as above. Are there any other working solutions for this issue?

rapha18th commented 2 years ago

I fixed it with changing 48th line to: table = soup.find('table',{'class': 'table table-striped table-bordered'})

Hi there, I tried this and I am still getting the same error as above. Are there any other working solutions for this issue?

Hi, it's the same for me, too did you find a fix?

mahajnay commented 2 years ago

same for me. can anyone suggest a fix?

Thomas-Richardson commented 2 years ago

Same for me, I get this error when i just try to import the twitterscraper module into python

KamilsobC commented 2 years ago

https://github.com/taspinar/twitterscraper/issues/367#issuecomment-967397314

joerod commented 2 years ago

I fixed it with changing 48th line to: table = soup.find('table',{'class': 'table table-striped table-bordered'})

Maybe submit an MR to fix this?

tugceozturkk commented 2 years ago

!pip install twitterscraper==0.2.7 bunu yükledikten sonra bende find_all hatası düzeldi ama bu kezde Error occurred during loading data. Trying to use cache server https://fake-useragent.herokuapp.com/browsers/0.1.11 Traceback (most recent call last): File "C:\Users\Samsung\anaconda3\lib\site-packages\fake_useragent\utils.py", line 154, in load for item in get_browsers(verify_ssl=verify_ssl): File "C:\Users\Samsung\anaconda3\lib\site-packages\fake_useragent\utils.py", line 99, in get_browsers html = html.split('

')[1] IndexError: list index out of range böyle bir hata verdi

bloodconfetti commented 2 years ago

twitterscraper CL0WN_LVSER --user -o tweets_username.json Traceback (most recent call last): File "C:\Users\redacted\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\redacted\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code exec(code, run_globals) File "C:\Users\redacted\AppData\Local\Programs\Python\Python310\Scripts\twitterscraper.exe__main.py", line 4, in File "C:\Users\redacted\AppData\Local\Programs\Python\Python310\lib\site-packages\twitterscraper\init__.py", line 13, in from twitterscraper.query import query_tweets File "C:\Users\redacted\AppData\Local\Programs\Python\Python310\lib\site-packages\twitterscraper\query.py", line 76, in proxies = get_proxies() File "C:\Users\redacted\AppData\Local\Programs\Python\Python310\lib\site-packages\twitterscraper\query.py", line 49, in get_proxies list_tr = table.find_all('tr') AttributeError: 'NoneType' object has no attribute 'find_all'

idk if this helps anyone/anything

jpzhangvincent commented 2 years ago

It's a significant issue. Is the package still actively maintained?

dairelad commented 1 year ago

I fixed it with changing 48th line to: table = soup.find('table',{'class': 'table table-striped table-bordered'})

Hi there, I tried this and I am still getting the same error as above. Are there any other working solutions for this issue?

Hi, it's the same for me, too did you find a fix?

Also tried this fix but still getting the same error

ArchivingToolsForWBM commented 1 year ago

I'm getting a similar problem, in 2022, using Python 3.7.3, on windows 10:

C:\Users\RedBro\AppData\Local\Programs\Python\Python37-32\Scripts>twitterscraper -help
Traceback (most recent call last):
  File "C:\Users\RedBro\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\RedBro\AppData\Local\Programs\Python\Python37-32\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\RedBro\AppData\Local\Programs\Python\Python37-32\Scripts\twitterscraper.exe\__main__.py", line 4, in <module>
  File "C:\Users\RedBro\AppData\Local\Programs\Python\Python37-32\lib\site-packages\twitterscraper\__init__.py", line 13, in <module>
    from twitterscraper.query import query_tweets
  File "C:\Users\RedBro\AppData\Local\Programs\Python\Python37-32\lib\site-packages\twitterscraper\query.py", line 76, in <module>
    proxies = get_proxies()
  File "C:\Users\RedBro\AppData\Local\Programs\Python\Python37-32\lib\site-packages\twitterscraper\query.py", line 49, in get_proxies
    list_tr = table.find_all('tr')
AttributeError: 'NoneType' object has no attribute 'find_all'

C:\Users\RedBro\AppData\Local\Programs\Python\Python37-32\Scripts>