13

As YouTube official documentation about implement and immigrate to API V3, they said:

YouTube Data API (v2) functionality: Retrieve video recommendations
The v3 API does not retrieve a list that only contains videos recommended for the current API user. However, you can use the v3 API to find recommended videos by calling the activities.list method and setting the home parameter value to true.

But now the parameter home has been deprecated too. Currently, when I set the home parameter to true, I only retrieve the recently uploaded video in the channel: Popular video in YouTube. There are no video with snippet.type=recommendation at all.

I need to show recommended videos of authenticated user in new feed, but seem like this feature is completely deprecated by YouTube. Anyone has solution for that?
Thanks first!

Khang .NT
  • 1,504
  • 6
  • 24
  • 46

4 Answers4

2

Unfortunately, I can't find any documentation or example about this feature. It seems that this has been deprecated. However, you may check this documentation with sample JSON structure that shows the format of a activities resource such as recommendation:

"recommendation": {
      "resourceId": {
        "kind": string,
        "videoId": string,
        "channelId": string,
},

Hope this helps!

abielita
  • 13,147
  • 2
  • 17
  • 59
1

I found this youtubes search api. All we need to do is put a video id in the relatedToVideoId and it'll giveout a list of videos related to it.

Nischit Pradhan
  • 440
  • 6
  • 18
0

The docs for the api include a way to test the request. code samples there show how to set 'mine' for an authenticated request.

youtube activities

This is android sample code. it would need to be in some background thread. The setmine = true on the channelList response is like the home (I think). Was not sure if your implementation was for the web or an app.

this is android code:

 YouTube youtube = new YouTube.Builder(transport, jsonFactory,
                    credential).setApplicationName(getString(R.string.app_name))
                    .build();

            YouTube.Activities.List activities;
            ActivityListResponse activityListResponse = null;
            List<ActivityData> activitiesData = new ArrayList<ActivityData>();

            try {
                /*
                 * Now that the user is authenticated, the app makes a
                 * channels list request to get the authenticated user's
                 * channel. Returned with that data is the playlist id for
                 * the uploaded videos.
                 * https://developers.google.com/youtube
                 * /v3/docs/channels/list
                 */

                ChannelListResponse clr = youtube.channels().list("contentDetails")
                        .setMine(true).execute();


               activities  = youtube.activities().list("id,snippet,subscriberSnippet");
                activities.setChannelId(clr.getItems().get(0).getId());

                activities.setMaxResults((long) 50);
                activityListResponse = activities.execute();

                ArrayList<String> subscriptionListIdentifier = new ArrayList<String>()
                        ,listTitles = new ArrayList<String>()
                        ,listThumbnails = new ArrayList<String>();

                List<Activity> results = activityListResponse.getItems();

                for (Activity activity : results) {
                    listTitles.add(activity.getSnippet().getTitle());
                    listThumbnails.add(activity.getSnippet().getThumbnails().getDefault().getUrl());
                    subscriptionListIdentifier.add(activity.getId());
                    //if ("public".equals(playlist.getStatus()
                    //        .getPrivacyStatus())) {
                    ActivityData data = new ActivityData();
                    data.setActivity(activity);
                    activitiesData.add(data);
                    //}
                }

                return activitiesData;
0

You can retrieve them using the following API call:

GET https://www.googleapis.com/youtube/v3/activitiespart=snippet%2CcontentDetails&channelId={channel—_Id}&maxResults=25&regionCode=tw&key={YOUR_API_KEY}
g00glen00b
  • 41,995
  • 13
  • 95
  • 133
金馆长
  • 217
  • 2
  • 7