0

I have a channel of 11 videos, YouTube Analytics returns data only on 9 of them. Here is what I am doing:

First we get the channels video list and make an array of video id.

    statslistitems_list_request = youtube.channels().list(part="snippet, statistics, brandingSettings, contentDetails")

    while statslistitems_list_request:
        statslistitems_list_response = statslistitems_list_request.execute()
        for statslistitems_item in statslistitems_list_response["items"]:
            .....
            playlistitems_list_request = youtube.playlistItems().list(
                playlistId=upload_playlist_id,
                part="snippet,status",
                maxResults=200,
            )
            ....
            for (counter, playlist_item) in enumerate(playlistitems_list_response["items"]):
                ... apend video id found ....

in the end, all is fine, we get the list of id's for example on channel id UCHoRqrRYds_IQ5uey8wAKDA , a list of 11 videos

The the problems is with Youtube Analitics:

    videoparser = argparse.ArgumentParser()
    videoparser.add_argument("--metrics", dest="metrics", help="Report metrics", default="views,comments,likes,shares")
    videoparser.add_argument("--dimensions", dest="dimensions", help="Report dimensions", default="video")
    videoparser.add_argument("--start-date", dest="start_date", help="Start date, in YYYY-MM-DD format", default=ten_years_ago)
    videoparser.add_argument("--end-date", dest="end_date", help="End date, in YYYY-MM-DD format", default=one_day_ago)
    videoparser.add_argument("--start-index", dest="start_index", help="Start index", default=1)
    videoparser.add_argument("--max-results", dest="max_results", help="Max results", default=videos_to_count) # 50
    videoparser.add_argument("--filters", dest="filters", help="filters", default='video==' + video_list) 
    videoparser.add_argument("--sort", dest="sort", help="Sort order", default="-views")
(options_video, args_video) = videoparser.parse_known_args()

    video_analytics_response = youtube_analytics.reports().query(
                ids="channel==%s" % channel_id,
                metrics=options_video.metrics,
                dimensions=options_video.dimensions,
                startDate=options_video.start_date,
                endDate=options_video.end_date,
                startIndex=options_video.start_index,
                maxResults=options_video.max_results,
                filters=options_video.filters,
                sort=options_video.sort
            ).execute()

    video_views_list = video_analytics_response.get("rows", [])

video_views_list will only hold 9 in the upper 11 video id list filter case.

Can you guys tell me why is analitics not returning the same length of video as the filter for video id.

More info: 11 video uploaded on the same day and hour, all video approved and 10 public. 1 video uploaded later.

video_id list:

    OtTgqVGZHiI,
    LJguqUv0Zwk,
    SDx7RYY6er8,
    K6-rH57e6kA,
    oHy4tQAc6Ic,
    7LstRv4eHXA,
    MNla8-2UK_Q,
    N_CrA9h_ZEE,
    PctdfcDm8EY,
    KZiqjNJUalY,
    5zRKUcn8vkE

Analitics response:

    [[u'oHy4tQAc6Ic', 5, 0, 1, 0], 
    [u'LJguqUv0Zwk', 3, 0, 0, 0], 
    [u'5zRKUcn8vkE', 2, 0, 0, 0], 
    [u'K6-rH57e6kA', 2, 0, 0, 0], 
    [u'PctdfcDm8EY', 2, 0, 0, 0], 
    [u'SDx7RYY6er8', 2, 0, 0, 0], 
    [u'7LstRv4eHXA', 1, 0, 0, 0], 
    [u'MNla8-2UK_Q', 0, 0, 0, 0], 
    [u'N_CrA9h_ZEE', 0, 0, 0, 0]]

mising id: OtTgqVGZHiI and KZiqjNJUalY

  • 1
    **(1)** Test if all is working fine now (maybe the YT servers were slow to update?). **(2)** Do you get a result of those 2 videos if you query the analytics of single video (not as a channel list query)? **(3)** What exact info you need from videos (_eg:_ number of views)? Because there might be other ways to get such info. – VC.One Nov 15 '20 at 00:33
  • still have the same problem. I request an analytical query from the YouTube SDK API, after I got a list of video_id from the YouTube API. I have integrated over a few thousands users and some are coming back to have this bug. I tried all request types and changes all filters, the problem is the same. YouTube is providing partial information on requested video. – Bogdan Iordachescu Nov 27 '20 at 12:29
  • _"YouTube is providing partial information on requested video"_ tell me the **video ID** and what **exact information** do you need from it, I will see if possible to get that from another way (not Youtube SDK). – VC.One Nov 27 '20 at 14:49
  • if its a problem with youtube, that's it, call it tech limitation. I needed to work with youtube api for the channel analysis. But thank you man – Bogdan Iordachescu Apr 20 '21 at 16:41

0 Answers0