Recovering tweets with media using tweepy - python

i'm having problem with the twitter api. I used this script Script to delete tweets
To delete the tweets form an account. I see that tweepy method (api,user_timeline) at
for status in tweepy.Cursor(api.user_timeline).items():
try:
will not return those tweets that contain media (accessing twitter from the website they don't show up in the timeline but in another tab called 'photos and videos') so they are not deleted. include_entities is not a parameter for this method.
how can i recover these tweets? I thought i could searching with the username as query, but that doesn't work and could be very inefficient.
is there another method on the twitter API or a parameter that's not included with the documentation?
Thanks for all the help!

I found that this is a problem twitter has when erasing massively tweets. Nothing we can do for now!

Related

Ideas for scraping reply for each tweet

Hi I'm new to scraping data from twitter and I've been working on a project to collect tweets and their replies. I scraped the tweets using twitter API , but I couldn't scrape their replies. Any suggestions ?
Scraping is not using API. API is a comfortable method to get data while scraping is doing it manually. If you want to get replies, but the API doesn't provide them, you can use selenium. It is well-known library used for scraping data.
Twitter API does not have an end-point to get replies to a tweet for free users, but there are some ways to achieve what you want, although there may be some limits on how many tweets you can get.
Check-out tweepy library, I think you could use the search method as is explained in this question(How to get the replies for a given tweet with tweepy and python?
). To better understand how to use the tweet object, you should definitely check the docs out.
You can achieve this by:
You want to get replies of #barackobama and Tweet Id is 1234 just example.
Search tweets having #barackobama is tweet text. then make filter on InrplytweetId=1234
by this method you can get replies of this tweet.

Twitter search API not returning tweet images

I have implemented the Twitter search api successfully, and am retrieving data in the exact way shown here: https://developer.twitter.com/en/docs/tweets/search/api-reference/get-search-tweets
The issue is that for tweets which contain uploaded images, I'm not getting those image urls in my JSON data. I do see the media URLs for quoted or re-tweeted tweets, but never for the original tweet itself, which I find very strange.
There is no documentation about media related parameters in the API guide either, but I'm sure there is a way to retrieve images.
I am using the python-twitter module.
Looks like Twitter docs are severely lacking. I added &tweet_mode=extended and a lot more data including media related params popped up.

How to pull tweet using twitter url in python

I have a twitter url ("http://twitter.com/1/statuses/860392275108548608") and I need to fetch the tweet using this URL.
I checked some python packages like twitter, tweepy, etc. Here there are functions to pull tweets for particular account and hashtags, but I could find any function to pull from URL.
Can someone please share the function to pull the tweet using url.
Thanks
You could use an HTML parsing library. It's not the best way to do it, but it will work. What you'll have to do is find a similarity in class or id that every tweet shares. You'll then get the text of that tweet by finding the textual value of the element.

Twython - get tweets only from one user, not to that user

Fairly new to Twython, hope I'm not sounding too dumb here.
Currently I have Twython listening to the Twitter streaming API for tweets from a single user, then triggering a relay to open a door. It's working well, but I've found that it will trigger whenever my target user tweets something (good) AND whenever anyone tweets anything to my target user (not good).
Is there any way to have Twython trigger an action only when a user tweets, and ignore any replies or new tweets that user?
Any help much appreciated - thanks for reading!~
you can check the tweet's user field (in the json you get from your stream listener) and verify that it was tweeted by the desired user.
look here for further details: https://dev.twitter.com/overview/api/users

How to use Twitter Streaming API?

I been successfully able to use Twitter REST API to do find tweets and retweet them automatically. Now I want to tweet user a Thank You Message, I am using Python and Tweepy for my BOT. I can do live collection of tweets, using Twitter Streaming API, but I can't understand how to use the API to send a thank you message to those who favorite my tweets. I saw both the documentations but couldn't understand and use much from there. I also tried to search for any example but couldn't find any good one for Streaming API.
Can anyone show me how to use it with tweepy to achieve the same. It would be nice if you can show how to use it when someone retweets my tweet or follows me, I want to send them a thank you tweet automatically.
PS: I understand that Twitter doesn't likes much automation. But its all for learning.

Categories

Resources