Closed rjsu26 closed 4 years ago
As of now, the information that you are looking for is not available (read Twitter does not give it)
I really doubt about the existence of this problem here. I am afraid if my problem is clear to you or not. Because, since the Html attributes given for each case is the same, so in case of a retweet or a tweet, the stats of that particular tweet should only be given. In fact, getting the stats of the post I retweeted would be going an extra mile.
The likes/replies/retweets count that you see in a retweeted tweet, are of the original tweet and not the retweeted one
pip3 install --user --upgrade -e git+https://github.com/twintproject/twint.git@origin/master#egg=twint
;Command Ran
import twint import time import datetime import json from operator import itemgetter import os
FILENAME = "testing.json" SEARCH_QUERY = "Trump visits India" SINCE_DATE = datetime.datetime(2020, 2, 14) END_DATE = datetime.datetime(2020, 2, 20) SCRAPE_RETWEETS = True
print("ALERT!! Filename is {} and search query is {}".format(FILENAME,SEARCH_QUERY)) print("Starting in 2 sec...") time.sleep(2)
current_end_date = SINCE_DATE + datetime.timedelta(days=1)
while SINCE_DATE != END_DATE: c = twint.Config() c.Output = FILENAME c.Limit=100 c.Native_retweets = SCRAPE_RETWEETS c.Search = SEARCH_QUERY c.Custom["tweet"] = [ "id", "created_at", "date", "time", "user_id", "username", "tweet", "replies_count", "retweets_count", "likes_count", "hashtags", "retweet", "user_rt_id", "user_rt", "retweet_date", ] c.Resume = os.path.join(os.getcwd(),FILENAME.split(".")[0] + "_resume.raw") c.Count = True c.Lang = "en" c.Store_json = True c.Hide_output = True c.Since = SINCE_DATE.strftime("%Y-%m-%d") c.Until = current_end_date.strftime("%Y-%m-%d") try: twint.run.Search(c) except AttributeError: print("\n[!] found a removed tweet probably\n") SINCE_DATE = current_end_date current_end_date += datetime.timedelta(days=1)