Open yimingStar opened 3 years ago
Hey, just passing and I don't really know the code enough to do a PR. Just to let you know I tried your branch and it did not work for me, although the issue is not related with the user agent I think.
@yeachan153 Genuinely agree with your suggestion for the purpose of letting the user notice the missing web elements. So I added the exception function into this Profile class, which will print out the missing attributes.
The fixed is in this commit https://github.com/bisguzar/twitter-scraper/pull/167/commits/c7bbf55f5bfe94255242035f82237123f4581c38
Is this solution still working?
When I use the new profile.py, I still get the same "local variable 'html' referenced before assignment"
error, because of a 400 response.
So this:
from twitter_scraper import Profile
profile = Profile(f"BarackObama")
print(profile.to_dict())
leads to:
Unable to get is_private in html, exception - local variable 'html' referenced before assignment
...
Uable to get the original page (400 error code), get mobile twitter page indead.
166