Twint: No user information is received with LookUp function [Urgent]

Created on 2 Jun 2020  路  8Comments  路  Source: twintproject/twint

Running on Twint 2.1.20 and Python 3.7.5

Twint does not return any info about a user with LookUp function. Both storing as dataframe and as user object gives empty results. I am on Windows, everything was fine yesterday but today no user information can be received, although tweets can be fetched...

Most helpful comment

@calebglawson Committed a fix yesterday to scrape data by user id - I was able to leverage their solution to issue #767.

In get.py change line 182 to the following:
response = await Request(url, headers={"X-Requested-With": "XMLHttpRequest"}, connector=_connector)

I don't fully understand why this works but this works for me!

All 8 comments

@calebglawson Committed a fix yesterday to scrape data by user id - I was able to leverage their solution to issue #767.

In get.py change line 182 to the following:
response = await Request(url, headers={"X-Requested-With": "XMLHttpRequest"}, connector=_connector)

I don't fully understand why this works but this works for me!

Thanks for your reply! But you mean 182 right? Because there is a variable called soup in line 183...

I think that's what he meant. After you update that line of code, how do you build a fresh version and bind it to the "twint" cli command?

I'm encountering this as well. I'll submit another pull request. I don't know why Twitter is looking for this specific header, but it's working so I won't complain!

I think that's what he meant. After you update that line of code, how do you build a fresh version and bind it to the "twint" cli command?

I'm just using the twint library but you should be able to do python setup.py install from the twint repo directory after making your changes.

Just tried this. The RAM storage doesn't work even after modifying get.py.

>>> import twint
>>> users_list = []
>>> c = twint.Config()
>>> c.Username = "realDonaldTrump"
>>> c.Store_object = True
>>> c.Store_object_users_list = users_list
>>> twint.run.Lookup(c)
25073877 | Donald J. Trump | @realDonaldTrump | Private: 0 | Verified: 1 | Bio: 45th President of the United States of America馃嚭馃嚫 | Location: Washington, DC | Url: http://www.Instagram.com/realDonaldTrump | Joined: 18 Mar 2009 6:46 AM | Tweets: 52285 | Following: 46 | Followers: 81518204 | Likes: 4 | Media: 3927 | Avatar: https://pbs.twimg.com/profile_images/874276197357596672/kUuht00m_400x400.jpg
>>> users_list
[]

I got this fixed by adding:

elif hasattr(config.Store_object_users_list, 'append'):
            config.Store_object_users_list.append(user)

below line 196 in output.py.

Please update your local package with pip3 install --user --upgrade git+https://github.com/twintproject/twint.git@origin/master#egg=twint

I'll push a new version to PyPI soon, in the mean time please do as suggested above

Was this page helpful?
0 / 5 - 0 ratings