As per the docs https://developers.google.com/youtube/v3/docs/activities/list it should be possible to get activities for my homepage, and filter using the publishedAfter parameter, to get activities published after say, 10th January 2015.
However it appears that this parameter is ignored (as is publishedBefore).
I've called this from code and also from the 'try it' page https://developers.google.com/youtube/v3/docs/activities/list#try-it using:
part=id,snippet
home=true
publishedAfter=2015-01-10T00:00:00.0Z
Request:
GET https://www.googleapis.com/youtube/v3/activities?part=id%2Csnippet&home=true&publishedAfter=2015-01-10T00%3A00%3A00.0Z&key={YOUR_API_KEY}
From response JSON:
...
"publishedAt": "2015-01-12T14:47:50.000Z",
...
"publishedAt": "2015-01-06T16:24:28.000Z",
...
"publishedAt": "2015-01-07T16:36:44.000Z",
...
"publishedAt": "2015-01-12T13:26:01.000Z",
...
"publishedAt": "2015-01-07T16:19:07.000Z",
...
Some of these dates are before 2015-01-10
Not sure whether I've missed something in the docs or this is a bug. It seems to work ok for 'my' videos (mine=true) and activities for a specific channel (channelId=abc123)
I have only recently created this account / enabled 'my' channel, in case this has any effect.
UPDATE just realised there are two open issues for this:
https://code.google.com/p/gdata-issues/issues/detail?id=6088
https://code.google.com/p/gdata-issues/issues/detail?id=6366
I am also not so happy with how the API responds to this term and suspect it might be fussy about the timestamp format. According to the docs, publishedAfter
and publishedBefore
need to be RFC 3339
formatted date-time value (1970-01-01T00:00:00Z
)
From what I have found, it seems publishedAfter
and publishedBefore
is still limited:
The developer page says "Note that if the relatedToVideoId parameter is set, the only other supported parameters are part, maxResults, pageToken, regionCode, relevanceLanguage, safeSearch, type (which must be set to video), and fields."
Other pages have expert comments:
"Status: Won't Fix (Obsolete)" [email protected] Dec 22, 2016 12:08AM. (Found through the link noted above by Nick Baker).
I tested it on the API Explorer and with Google Script using apps script. Only when I use the relatedToVideoId
script the publishedAfter
and publishedBefore
do not work. When I only query a keyword without using relatedToVideoId
, then the publishedAfter
and publishedBefore
do work.
If you cannot get it to work with the relatedToVideoId, then you can report it in the Issue Tracker, but I think they know already. I'm hoping to find a work-around.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With