Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
steeley opened this issue Oct 6, 2021 · 13 comments

Comments

@steeley
Copy link

steeley commented Oct 6, 2021

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/[email protected]/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/[email protected]/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
Copy link

MonikaBarget commented Oct 8, 2021

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
Copy link

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

@hinceme
Copy link

hinceme commented Oct 19, 2021

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
Copy link

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
Copy link

mahajnay commented Nov 1, 2021

same for me. can anyone suggest a fix?

@Thomas-Richardson
Copy link

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

@KamilsobC
Copy link

#367 (comment)

@joerod
Copy link

joerod commented Dec 12, 2021

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
Copy link

tugceozturkk commented Jan 31, 2022

!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
Copy link

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

DaniruKun added a commit to DaniruKun/twitterscraper that referenced this issue May 29, 2022
@jpzhangvincent
Copy link

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

@dairelad
Copy link

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
Copy link

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>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests