Open jalilbm opened 3 years ago
I also got same issue, below is the error
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): twitter.com:443
DEBUG:urllib3.connectionpool:https://twitter.com:443 "GET /pradeepbatchu HTTP/1.1" 400 None
Traceback (most recent call last):
File "D:/twitt.py", line 15, in <module>
gettwitter_profile('pradeepbatchu')
File "D:/twitt.py", line 7, in gettwitter_profile
profile = Profile(twitter_handler)
File "C:\Users\prade\anaconda3\lib\site-packages\twitter_scraper\modules\profile.py", line 41, in __init__
self.__parse_profile(page)
File "C:\Users\prade\anaconda3\lib\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
I also got the same error to what jalilrooney reported.
By getting the response code <400> from the request; it seems like the old version server side render api has been changed. I just get the html by replacing the User-Agent. However, the selectors query need to change, since the new webpage did not contain the same column.
I have the same error. Can somebody point out a way to solve it. Sadly I'm not an experienced cooder yet. How did you solve this with the User-Agent @yimingStar? Can you explain that in detail? That would be nice! Thanks a lot
Hi, @danielp3011 I made a pull request here - https://github.com/bisguzar/twitter-scraper/pull/167
Because the original page cannot show up, I use another user-agent to get a mobile version web page (mobile.twitter.com). Next, we'll have to rewrite the selectors, since the class name of the web elements have changed. By the way, there still are some elements we cannot get, but most of them are fine.
Please leave a review for PR @danielp3011 . So I can merge it easyly. Thanks for your efforts guys!
Should this fix still be working? I tried it on my local file but I am still getting the 'html' error...
Same, I still got the error. "UnboundLocalError: local variable 'html' referenced before assignment."
getting the same error here. Is there no workaround?
I am getting same error.
I tried a basic profile selection:
profile = Profile(user_name)
And I got this error:
I believe that something changed on twitter website