Twitter search API not returning tweet images - python

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.

Related

Instagram Graph API problem by using /insights edge

I'm trying to learn more about Instagram Graph API and I received a problem during my data retrieval.
When I try to use {ig-user-id}/insights edge I get this error.
(#100) Tried accessing nonexisting field (insights) on node type (InstagramUser)
I'm moving step by step as API documentation shows, but I realized that the Instagram Graph API document is out-dated.
How can I receive basic insights data of a Professional Instagram Account and each media of it?
Thanks in advance!
{ig-user-id}/insights?metric=impressions,reach,profile_views&period=day&access_token={your-access-token}
This API endpoint call should work.
Refer to this link: https://developers.facebook.com/docs/instagram-api/reference/user/insights
It's updated and working, tried it myself, and even look for all the permission to be given mentioned in the link.
Limitations:
Insights data is not available on IG Users that have fewer than 100 followers.
Insights data for the online_followers metric is only available for the last 30 days.

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.

Recovering tweets with media using tweepy

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!

Accessing Facebook Graph API video insights using Python

I'm having trouble accessing video insights for a page that I'm an admin of. Specifically, I'm looking for these metrics.
I have generated a token that gives me manage_pages, read_insights, and read_stream access. When I use the Graph API tool on Facebook's website with this:
[postID]/insights/post_video_views_organic
I get the views I am looking for. However, when I use the Facebook SDK like so:
graph = facebook.GraphAPI([myUserToken])
graph.get_object('/[postID]/insights/post_video_views_organic')
I get an empty "data" field returned. Does anyone know how to return the data using Python?
PS- should mention, I am able to get regular Insights data using the Python SDK.
I was able to get video insights by refreshing the token again. As I've been playing with this stuff, it seems that access to video insights is much, much more finicky than the regular page insights. With the same call each time, I get an error 50% of the time.

How can I access SoundCloud-Stream URLs in Python?

Some time ago I wrote a little tool for a friend of mine. I retrieved all stream-links (like this) from a soundlist and downloaded all those with a small python script.
Since begin of March, soundcloud must have changed something, and now my cronjob recieves 401 Unauthorized errors. I've read through the soundcloud API, but that whole Access Token does not really fit my needs.
Has anyone of you an idea of easily dealing with this problem? Thanks.
As Makoto said, 401 seems like you have lost priviledges to access through your OAuth token so I would double check to make sure your app is still available and that your tokens are correct. You can check on the Your Apps Page.
Also, I noticed that your url seemed a bit different than what the SC api shows. Once you resolve to get a proper track id, the convention for a stream url is:
http://api.soundcloud.com/tracks/{id}/stream
This can be found in their track documentation.
Read the documentation here. You have to add your client_id parameter to the stream url and then you will be redirected to the stream link (mp3).

Categories

Resources