Youtube get user uploads in php - youtube-api

I am trying to get the full list of videos uploaded by a user.
I am using the following url:
https://gdata.youtube.com/feeds/api/users/username/uploads?v2&alt=json
And using curl in php to get the contents.
But I am getting only 25 results. If I use the max-results, the max is 50.
What should I use in order to get the whole list?

After replacing 'username' with a valid name the response shows a url link for the next request in the response you get. Look for: {"rel":"next","type":"application/atom+xml","href":"https://gdata.youtube.com/feeds/api/users/username/uploads?alt=json&start-index=26&max-results=25"}
As you can see another parameter is added: 'start-index'. Which you also can add yourself
BTW. I assume you know there is a typing error in your example. You set the version parameter by using 'v=2' instead of 'v2'.

I suggest using YouTube Data API v3 for this purpose.
You can get to use PHP examples in YouTube API Samples project.

Related

PHP Youtube API: Search videos where a URL is within the description

I'm working on a site where they have recently changed their domain. I'm trying to get a list of all the videos that contain that domain and change to the new domain using the Youtube API.
I am using the developers PHP example on search list, changing the 'q' value to be equal the old website domain and also adding a channelId parameter so that it'll only search inside their channel.
The problem is that some of the results do not contain the old URL in the description. Am I doing something wrong?
Thanks!
AFAIK there isn't any official YouTube Data API v3 endpoint to directly do what you are trying to.
If I were you I would list the YouTube channel's videos and then use Videos: list with part=snippet to retrieve their descriptions and then I would locally filter the retrieved descriptions.

Get Video Information from ChannelD

I am looking for the json from where i can get information of video falls in specific channel(ChannelId is given). I tried below to get the same, but page not found showing.
https://www.googleapis.com/youtube/v3/search?key=***&channelId=UC39dDX5cE3WxN5ObmCBsCCQ
Or any other effective way to fetch the information?
Api version 3 returns only json in responses. You find information at https://developers.google.com/youtube/v3/docs/
Channel information returns a playlist-id of the uploaded videos for a channel.
But using search can work too (Replace YourApiKey with your own key):
https://www.googleapis.com/youtube/v3/search?part=snippet&type=video&channelId=UC39dDX5cE3WxN5ObmCBsCCQ&maxResults=50&key=YourApiKey

Has Twitter removed the unauthenticated user RSS timeline feeds?

I have previously used the following URL to access my tweets and embed them on a website:
http://twitter.com/statuses/user_timeline/my_username.rss
It seems that just this morning though, I'm getting the following error:
Sorry, that page does not exist
Does anyone know what might have happened to this service, and what an alternative might be?
Try http://api.twitter.com/1/statuses/user_timeline.rss?screen_name=USERNAME
It appears that this is a permanent change made by Twitter (see Twitter API's tweet)
Instead they're moving to a versioning system like below:
https://api.twitter.com/1/statuses/user_timeline.rss?screen_name=twitter_username
By changing the user_timeline file extention you're able to receive the feed in different formats, IE:
https://api.twitter.com/1/statuses/user_timeline.xml?screen_name=twitter_username
https://api.twitter.com/1/statuses/user_timeline.json?screen_name=twitter_username

Pulling Retweets using Twitter user_timeline in JSON format

I'm currently using the script..
http://twitter.com/statuses/user_timeline/username.json?callback=twitterCallback2&count=1
.. to pull the most recent Tweet for a number of users to display on my website. However, I've ran into the problem that the JSON format doesn't display Retweets. I've read from this link that you must use "retweeted_by_me" to also display Retweets by I'm not quite sure how I would merge that with my current script.
EDIT : As of Twitter API Version 1.1, use the following format. (Needs Authenticaton)
https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=nikhilkuruvilla&include_rts=true
The updated documentation can be found here
https://dev.twitter.com/docs/api/1.1/get/statuses/user_timeline
[UPDATE] The following methods apply to Twitter API Version 1 and is Deprecated now.
Use the new twitter API and add include_rts=true Eg: http://api.twitter.com/1/statuses/user_timeline.json?screen_name=nikhilkuruvilla&include_rts=true
Full documentation can be found here : http://dev.twitter.com/doc/get/statuses/user_timeline
If you read the GET statuses/user_timeline documentation you fill find that by adding a parameter of include_rts set to true it will include retweets.
Change response mode to rss. This will resolve the issue. It might require change in the display code depending on your scripting language though.

Retrieve full URL in Twitter Search API

I am using the Twitter Search API to search for a URL. Here's an example:
http://search.twitter.com/search.json?q=url.com
The JSON response gives me the shortened URL of each search result. Is there a way for me to retrieve the full URL of each result?
From 11/2011, you can use the include_entities=true parameter to retrieve full tweet entities, which include the expanded URL (and a lot more)
https://dev.twitter.com/docs/using-search
You will have to pragmatically request each URL yourself and see where it redirect to.
On Twitter Search, you can use the same URL endpoint that Twitter Search uses to expand shortened URLs: http://search.twitter.com/hugeurl. For example, if you wanted to expand the shortened URL http://bit.ly/jIhqhq:
$ curl "http://search.twitter.com/hugeurl?url=http://bit.ly/jIhqhq"
http://edition.cnn.com/2011/SPORT/football/05/03/may.03.cnn.top.10/index.html/
This will only work for the more popular shorteners (bit.ly, j.mp, etc.) Also, this AJAX endpoint is pretty aggressively rate-limited, so don't expect to be able to use this for a production application, but something like 10 times an hour should be fine.
Not currently through Twitter. On Twitter.com, those shortened URLs are automatically expanded into something readable, however search.twitter.com doesn't seem to be expanding the t.co shortened URLs at this time.

Resources