iSarabjitDhiman / TweeterPy

TweeterPy is a python library to extract data from Twitter. TweeterPy API lets you scrape data from a user's profile like username, userid, bio, followers/followings list, profile media, tweets, etc.
MIT License
123 stars 17 forks source link

Cannot get full 'full_text' #60

Closed zxj0302 closed 2 months ago

zxj0302 commented 2 months ago

When I was trying to scrape a tweet with tweet_id, I used get_retweet() function. However, the 'full_text' attribute in the returned structure is not complete. For example:

id = 1623629869908213760 result = twitter.get_tweet(id)

The tweet content extracted from 'full_text' in 'result' has some part missing in the end. Is there are some limitations for the text length? I also tried to 'log in', still cannot get 'full' text.

iSarabjitDhiman commented 2 months ago

Hmmm that's strange, I tried it on my end it works fine. Attaching the result below... Maybe you are extracting the incorrect datapoint? You can also use the Tweet dataclass to extract common datapoints.

from tweeterpy.util import Tweet

id = 1623629869908213760
result = twitter.get_tweet(id)
tweet = Tweet(result)
print(tweet)

# you can also convert it into dictionary
print(tweet.dict())

This is the result I got

image

# You can also extract the required data fields by using find_nested_key function from util.py module
from tweeterpy.util import find_nested_key

print(find_nested_key(result,'full_text'))

Let me know if it works. Edit : I tested it with a guest session i.e. without log in. It still works.

zxj0302 commented 2 months ago

Thank you so much! It works! Maybe something went wrong in my code but now it works perfectly! Thank you again bro. I will try to use Residential proxy to scrape tons of tweets for next step. Your work helps me a lot!!!

iSarabjitDhiman commented 2 months ago

You're welcome. Feel free to close the issue.

zxj0302 commented 2 months ago

You're welcome. Feel free to close the issue.

Thank you!