bisguzar / twitter-scraper

Scrape the Twitter Frontend API without authentication.
MIT License
3.88k stars 601 forks source link

UnboundLocalError: local variable 'html' referenced before assignment #169

Closed dgnsrekt closed 3 years ago

dgnsrekt commented 3 years ago

Profile class appears to be broken.

Ran the following code.

from twitter_scraper import Profile

profile = Profile("dgnsrekt")
print(profile.name)
print(profile.user_id)

Output:

Traceback (most recent call last):
  File "main.py", line 3, in <module>
    profile = Profile("dgnsrekt")
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/twitter_scraper/modules/profile.py", line 41, in __init__
    self.__parse_profile(page)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/twitter_scraper/modules/profile.py", line 65, in __parse_profile
    self.location = html.find(".ProfileHeaderCard-locationText")[0].text
UnboundLocalError: local variable 'html' referenced before assignment
dgnsrekt commented 3 years ago

Version: Python 3.8.2 (default, Feb 26 2020, 02:56:10)

https://repl.it/@dgnsrekt/twitter-scraper-169

dgnsrekt commented 3 years ago

I missed issue #166.