Skip to content

Instantly share code, notes, and snippets.

@jpluimers
Created March 22, 2022 15:25
Show Gist options
  • Save jpluimers/fff6e9bc24833f569db1176f17f553f3 to your computer and use it in GitHub Desktop.
Save jpluimers/fff6e9bc24833f569db1176f17f553f3 to your computer and use it in GitHub Desktop.
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)
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment