The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,860 other subscribers

Python code from @baekdal (find tweets you retweeted by someone else)

Posted by jpluimers on 2023/10/26

Need to try this out: [Wayback/Archive] Code from https://twitter.com/baekdal/status/1279123542144094208 and https://twitter.com/baekdal/status/1279123544052563968 (find tweets you retweeted by someone else)

Related tweets:

  1. [Wayback/Archive] Thomas Baekdal on Twitter: “But, wait, you say, can’t I just do that with Twitter search? Nope… because I couldn’t remember who tweeted it, only that I had retweeted it, and so if I do the search on Twitter, I get this: Twitter search doesn’t include pure retweets when searching ‘from me’.”

  2. [Wayback/Archive] Thomas Baekdal on Twitter: “For instance, I needed to find a tweet of CNN control operations team working from home, so now I just use my tool to search for ‘CNN’ and there it is.”

  3. [Wayback/Archive] Thomas Baekdal on Twitter: “But, wait, you say, can’t I just do that with Twitter search? Nope… because I couldn’t remember who tweeted it, only that I had retweeted it, and so if I do the search on Twitter, I get this: Twitter search doesn’t include pure retweets when searching ‘from me’.”

Another piece of code he wrote (found via [Wayback/Archive] @baekdal twitter api – Twitter Search / Twitter) was to get a Twitter circle: [Wayback/Archive] Thomas Baekdal on Twitter: “BTW: The code for extracting this data is really simple (using Python). Just import the Twitter API, and run thought the posts, putting each one into their own lists.”:

 

Via: [Wayback/Archive] Marius Popescu on Twitter: “@UScLE There is this solution using from:me but it doesn’t search your retweets, people use API scripts for that”

–jeroen



for getstatus in range(0,10):
if lastid == '':
statusesraw = api.GetUserTimeline(screen_name-twitteruser,count-tweetcount, include_rts=1)
else:
statusesraw = api.GetUserTimeline(screen_name=twitteruser,count-tweet count, include_rts=1,max_id=lastid)
statuses += statusesraw
lastid = statuses[-1].id
for status in statusesraw:
tweettxt = ''
if status.retweeted:
try:
tweettxt tweettxt + ' ' + status.retweeted_status.text
except:
pass
tweettxt = tweettxt + ' ' + status.text
if status.quoted_status:
tweettxt = tweettxt + ' ' + status.quoted_status.text
if tweettxt.lower().find(twittersearch) != -1:
print('————————-')
print('Tweet id:', status.id)
print(tweettxt)

view raw

findTweets.py

hosted with ❤ by GitHub


Z:\python>twitter-search.py
Person:
Search: cnn
Twitter search: cnn
————————-
Tweet id: 1274087828780187652
https://t.co/3uPw3MYVrs https://t.co/1d5A3CnNmf Daily Mail eclipses the Sun to become UK's top-selling paper https://t.co/W5EUSE5gQF
————————-
Tweet id: 1270393837626822656
Behind the scenes: How @CNN's master control operations team is keeping multiple networks on the air while working… https://t.co/wlr6BrALTX RT @brianstelter: Behind the scenes: How @CNN's master control operations team is keeping multiple networks on the air while working from h…
————————-
Tweet id: 1269267852906893312
Canadian Prime Minister Justin Trudeau took a knee during a Black Lives Matter demonstration in Ottawa on Friday https://t.co/SCEI7oWaWv RT @CNN: Canadian Prime Minister Justin Trudeau took a kne e during a Black Lives Matter demonstration in Ottawa on Friday https://t.co/SCEI…
————————-
Tweet id: 1267599712791781384
CNNS chyron writer today is on point . https://t.co/VwYaG7QnZd RT @rgay: CNNS chyron writer today is on point . https://t.co/VwYaG7QnZd
————————-
Tweet id: 1266965680169127936
What a moment on CNN. https://t.co/T9XMzXmlVb RT @oliverdarcy: What a moment on CNN. https://t.co/T9XMzXmlVb
————————-
Tweet id: 1266342205490429954
CNN's @Omar Jimenez and his crew have been released from police custody. He recounts getting arrested and what happe… https://t.co/WATYCKBTTW RT @CNN: CNN's @OmarJimenez and his crew have been rel eased from police custody. He recounts getting arrested and what happened while they…
————————-
Tweet id: 1266329384799088640
Live now on CNN as reported by @JohnBerman: CNN president Jeff Zucker spoke to Minnesota Gov. Tim Wola who apologiz http:llt on lubr5y6677 RT Ashbydphilling Live now on CNN poported by John

view raw

output.txt

hosted with ❤ by GitHub

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.