Youtube v3 api PublishedAfter search - youtube

I'm trying to retrieve videos posted last 10 minuttes , but query is retrieving videos from 2015
https://www.googleapis.com/youtube/v3/search?part=snippet&maxResults=25&publishedAfter=2018-02-13T23%3A10%3A00Z&q=surfing&key={MyAPIKey}
After looking around in forums, only advice I found was try to add the PublishedBefore option, but that did not help either.

I used your example and get the 2015 results, but it looks like your datetime is in the future. How did you calculate the datetime?
I just now used format 'Y-m-d\TH:i:s\Z' for '10 min ago' and the time is quite different. This link returned the expected results.
https://www.googleapis.com/youtube/v3/search?part=snippet&maxResults=25&publishedAfter=2018-02-13T14%3A14%3A58Z&q=surfing&key={MyAPIKey}
So even though I responded 13+ hours after your post, my datetime is still about 9 hours before your example.

I managed to get this working. Here's the things you can double check. Make sure you are providing the correct date format as can be seen in the publishedAfter in the search.list:
2018-02-12T00:00:00Z
Also make sure the API Key you're using has the Youtube Data API "ENABLED" in your google dev console.
So, using your exact URI request, it looks like this:
https://www.googleapis.com/youtube/v3/search?part=snippet&maxResults=25&publishedAfter= 2018-02-12T00:00:00Z
&q=surfing&key=API_KEY

Our URL is below:
https://www.googleapis.com/youtube/v3/search?part=id%2Csnippet&maxResults=40&channelId=xxx&type=video&order=date&publishedAfter=2019-03-14T00:00:00Z&fields=items%2Fid%2Citems%2Fsnippet(title%2CpublishedAt)&access_token=yyy
Note I have replaced our Channel ID and Access Token with substitute values for this post.
The publishedAfter parameter is not working and has never worked for us. This wasn't a problem until the March 15-16 timeframe when something changed w/ the YouTube API and the order parameter is no longer being considered by their service. Since that time, all videos are being returned by their API in order of upload date (for us, this means starting w/ 2015).

Related

Google API (youtube search) always sorts results by relevance instead of date

I use Google API to get a JSON result of my own YouTube channel videos.
The URL has not changed, but suddenly, Google returns the JSON only with order=relevant instead of order by date.
https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=UCqEcEGQ0sG89j7ZhOdgFOyg&maxResults=24&order=date&type=video&videoType=any&key=<key>
The first result returned will be a 2 year old video instead of yesterday's one.
This call did work 'till last week (week 11 2016)
From this thread, it seems it is a bug and that the YouTube team is aware of it. A Google employee responded 3 days ago with:
YouTube is aware the search/sorting functions aren't working as
expected – this is temporary and part of our efforts to better
respond, review and remove graphic, violative content from YouTube.
Thanks for your patience while we work through this. Will update this
thread when these features are working normally again, feel free to
subscribe for updates.
You can subscribe to the thread for faster updates.

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.

About YouTube search list API V3

In my application, I have used youtube.search.list API v3 for searching whole videos included in specific channel.
Example:
https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=[CHANNEL_ID]&q=[KEYWORD]
'q' is parameter for search keyword.
In my case, I used only 'q=' without keyword because I'd like to search whole videos.
It's working well at least until yesterday(27.Aug). but now, the server response is always 'totalResults: 0'
Could you tell me whether it's temporary wrong operation or the policy about this API is changed?
You can test above problem in the below url :
http://developers.google.com/apis-explorer/#p/youtube/v3/youtube.search.list?part=snippet
The issue has been reported to the gdata issues list five times in the last 24 hours or so. Regardless of whether it's deliberate or not, there's a lot of people concerned.
The first instance report:
https://code.google.com/p/gdata-issues/issues/detail?id=6598

twitter api 1.1 url count alternative

I've been using the old url api(v1) to get the count of a given url, lately I needed to get also the re-tweets and started searching about that.
this is the exact url I'm using right now:
http://urls.api.twitter.com/1/urls/count.json?url=http://google.com
As I viewed with some reading the v1 api is deprecated but at least it's still working.
I found some questions on the dev page of twitter:
https://dev.twitter.com/discussions/12643
those are a little old questions and have no specific solving to the problem. I mean, the most near solution was using the search api(search/tweets) which could be good but not a exactly replacement for the urls/count method.
Please note that Twitter's search service and, by extension, the
Search API is not meant to be an exhaustive source of Tweets. Not all
Tweets will be indexed or made available via the search interface.
also it has a limit for 100 results at maximum per 'page', even it throws the link to get the next set of objects, thats good but when the search reaches 1 million of results I'll need to get page over page to now how much tweets I got and having to do to much request to the api...
I sought some question over the dev page on twitter suggested using the stream api, I've tried using (statuses/filter) but that don't work very well given a URL as track param(which they said that is the keyword to track).
So, anyone who's been using the old urls/count has found a reliable alternative with the new apiv1.1, especiffically to get the tweets and re-tweets for a given url ?
The official suggestion by Twitter staff is that either the search/tweets endpoint (having just the last 7 days data) or the Streaming API be used (handling yourself the counters, making everything just too complicated for a d*mn counter).
As an extra warning, the old endpoint (http://urls.api.twitter.com/1/urls/count.json?url=YOUR_URL) will stop working on November 20th, and according to this blog post from Twitter there are no plans to replace it with anything in the short term and they are even removing the count from their own buttons.

Twitter API 1.1 search/tweets - search by date

Since the "since" param is no longer in use, how can I search tweets older than specific date ? I understand how to use since_id, but in my case I don't have any historic tweet to take the tweet_id from. How is search by date done these days ?
It's an old question, but since it has no answer i share what i have found regarding this question by reading the docs and using the API.
Since and until params are only for maximum 9 past days.
Instead we can use since_id and max_id. You have to set them to unique ids of tweets. You can find one tweet in the specified time (from any user you want). Detect the id by using the API or simply by Developer tools of your browser.
You can use the until param:
Returns tweets generated before the given date. Date should be
formatted as YYYY-MM-DD. Keep in mind that the search index may not go
back as far as the date you specify here.

Resources