Youtube feed limit results - youtube

I am trying to create a Youtube feed reader using https://www.youtube.com/feeds/videos.xml?channel_id={CHANNEL:ID}, everything works but I want to read only one or two entries.
Is this possible to limit these feeds to return only a concrete number of entries? I don't want to use the V3 api as it will restrict the number of calls per day.
Cheers

The old-fashion way of limiting/paginating results of feeds have been depracated long ago and tourned off since 2015 along with YouTube Data API v2.
https://www.youtube.com/feeds/videos.xml?channel_id=XXXXX is still on but fixed (and limited) to 15 results.
So, one of the two:
- migrate to YouTube Data API (v3)
or
- parsing yourself the feed server side (PHP or whatever) to get only the first one/two results.
sadly, no other way.

Related

YouTube API "mostPopular" requests doesn't seem to give updated results

It seems that the YouTube API doesn't give updated results for mostPopular videos in my country since few days.
Example:
This request (https://www.googleapis.com/youtube/v3/videos?part=snippet,contentDetails&chart=mostpopular&regionCode=FR) doesn't give me the same videos results than the ones displayed directly on YouTube for the French most popular channel (https://www.youtube.com/channel/UCmzy72gDEpfXoFV9Xdtd0DQ). It seems that the results of this request is not updated since the 1th of february. Results was real time updated before this.
Does someone know if something is wrong with my API request, or if there are some issues with the YouTube API at this moment?
There is nothing wrong with your request. This is a known issue with the YouTube API reported here for Saudi Arabia (but also applicable to multiple regions), and another related issue here with regard to content from France.
Your best bet would be to follow up with the YouTube team on one of those defects, or potentially (and dangerously) scrape the YouTube site for the correct results.
Problem seems to be solved since 13th of february (maybe someone from Google have seen my post..)
YouTube Channels and chart=mostPopular parameter data are separate data entities, aka you will get different results. They may be related but there is no guarantee you will get the same data. To get the data that you want you may need to query for channel itself and its videos.
I got this information from the thread #Jal linked, there was an update by matthewc...#google.com a few days ago:
The most popular channel for Saudia
Arabia and
the mostPopular chart parameter in the video.list
call
are separate and distinct entities. If you'd like to get the content
of the most popular channel for Saudia
Arabia
please use the Data API video.list call to list the videos with the
channel ID (in this case "UCWY-_j1MCth6yf24m58Bh_Q") by setting the
items/snippet/channelId parameter.
My current concern right now is that there is supposedly a way to get video information from the videos.list endpoint using a channelId, which does not seem the case in the API Explorer. I will update my answer once I figure out what this person meant exactly.

What is the correct url for the youtube query API

I am trying to use the youtube query API. From the google developers page, I got this sample:
https://gdata.youtube.com/feeds/api/videos?q=football+-soccer&orderby=published&start-index=11&max-results=10&v=2
But this does not work. What I really want to do is find a list of videos, not more than 10 min in length but with views more than 10,000, launched within the last 30 days.
This is the old depriciated API. Use the new V3 Api https://developers.google.com/youtube/v3/?hl=en

Obtain analytical data for a specific video within a date range

So after scouring the youtube API, and thinking that this may not be possible, I'll give a last try here.
In a nutshell, I am trying to obtain analytical data from youtube's analytics's API for specific videos for a date range (by day if possible). I've found ways to get the channel data that the video reside in, but I have been unable to find how to ontain the specific video data itself. Assuming it exists in v3 that is.
Anyone had any luck with this kind of task at all? Has this feature been developed for v3 as of yet?
Channel Reports is the API to retrieve video metrics. It can filter by video, by country, by lead (for some fields) and accepts timespan and data aggregation granularity. In brief, Available Reports lists all the valid query parameter combinations.
Individual comments can be retrieved with v2 Data API - together with their dates.

What is the easiest way to get the latest comment on any of my videos, using v2 of the YouTube API?

As pointed out in the question How do I fetch comments in version 3 of the YouTube API?, there is currently no way of fetching video comments using version 3 of the YouTube API. Now I'm trying to figure it out using version 2 instead.
What I want is the latest comment on any of my uploaded videos, in other words the latest comment in the "aggregated" comment feed of all my videos.
It seems like the only way to do this is too fetch all videos, and then make a call for each of them to get the comments. With a few hundred uploaded videos, this becomes very expensive in terms of number of API calls and total time for completion.
Is there a simpler and/or better way?
There's no way to be "notified" via the API when a video gets a new comment, so you're going to have to do some polling. The comments feed for a given video id, e.g. https://gdata.youtube.com/feeds/api/videos/fhWaJi1Hsfo/comments?v=2 for video id fhWaJi1Hsfo, is sorted in reverse-chronological order by default, so the last comment added should always be first in the list of entries.
Making a request for the comments feed of several hundred videos, even if you do that a couple of times a day, doesn't sound like an unreasonable amount of traffic. You should follow the best practices outlined in this blog post if you do run into any quota issues, though.

Python twitter crawler for tweets older than one week?

For an academic usage, I would like to analyze about three months of tweets. However, it seems the official Twitter search API doesn't provide tweets older than one week.
I've tried to write a self crawler, however, given a search keyword, Twitter page will not show tweets older than about one week.
Is there any trick that I can get older tweets? Or my best bet is to hit the API once a week and do it for the following three months?
From the Twitter API documentation regarding limitations:
- The Search API is not complete index of all Tweets, but instead an index of recent Tweets.
- At the moment that index includes between 6-9 days of Tweets.
- You cannot use the Search API to find Tweets older than about a week.
So, yes, if you need to collect a certain span of time, it will require multiple queries, as you suggested.
(You should also read this answer: retrieving tweets from specific user older than 7 days)
There are also currently two commercial companies that have access to the Twitter firehose and can provide this data (they are called "licensed re-syndicators"):
Gnip - offers 30 days of Twitter data
DataSift - up to two years of Twitter data

Resources