migueesc123 / YoutubeAnalytics

A Microsoft Data Connector or Power Query Connector for YoutubeAnalytics data
MIT License
61 stars 21 forks source link

Limited rows to 200 video's views #12

Closed jeffresnick closed 5 years ago

jeffresnick commented 6 years ago

Hi Miguel, really like your work. I posted on the PowerBI community page about a difference between the total views from your template and the total views shown on my YouTube channel's analytics on YouTube itself. I looked through the code, and see the following:

VidNoNulls = Table.SelectRows(#"Expanded id", each [videoId] <> null and [videoId] <> ""),
   VideoList = List.Buffer(VidNoNulls[videoId]),
   maxIterations = Number.RoundUp( List.Count( VideoList) /200),
   setofVideos= List.Generate( () =>
          [Result = Text.Combine(List.Transform(List.Range(VideoList,0,200), Text.From), ","), Offset = 0, Counter = 0],
                each [Counter] < maxIterations,
                each [Result = Text.Combine( List.Transform(List.Range(VideoList,[Offset]+200,200), Text.From), ","),
            Counter = [Counter] +1,
            Offset = [Offset] + 200], each [Result]),

I'm guessing that you're using the youtube analytics API instead of the youtube reporting API where you may be limited to returning 200 rows, so maybe since I have ~1900 videos, the views for videos after my 200th most watched video of the day, are not counted. Do you think that is why I have a difference? I'm not confident in parsing this code, just a guess, so let me know your thoughts and if you would have a way to incorporate the YouTube reporting API to get around this limit. Thank you!

For reference see the section "Key Differences">"Sorting" https://developers.google.com/youtube/reporting/

migueesc123 commented 6 years ago

Hey!

Thanks for giving this a try. The code in question is used just to make sure that I do not go over the 200 vids per request limit that the API has, but before that: image Where it does get all of the videos (even unlisted and private videos), I have no limits on how many videos I get. I basically get all of them, but I can only query 200 at a time for the "daily stats" hence why you see that 200. You can see this by clicking on the "Videos" table which should show all of the videos for your Channel. I tested the connector with a friend that has over 2000 videos and there were some differences with values back from 2008, 2009 and 2010 / apparently the API had some issues back then which might be causing the differences in views.

The differences in views might be something different. Do you have a video that we could use a sample? like what should be the total views vs what are the ones taken from the API through this custom connector?

jeffresnick commented 6 years ago

Thanks for pointing that out, I did notice that you were getting Unlisted videos which is what I thought the issue would have been (but I'm glad that you accounted for that). I'd be happy to give you a test video. The following video shows that it has 83,636 views on YouTube but the screenshot of the Videos Performance tab shows only 49,391 views. Let me know if you need other information to dig in further. Thank you for taking the time to help!

https://www.youtube.com/watch?v=zj2EoTkpz1k

image

migueesc123 commented 6 years ago

Could you do a comparison by day to see where the differences are coming from? Also, just to double check, the screenshot is a view of unfiltered data, right? (no filters on dates, that is)

migueesc123 commented 6 years ago

Hey,

Just wanted to follow up on this. Were you able to find out where the differences came from? From a code standpoint, the calls are correct, but maybe there was a glitch at the API and some views are not accounted for at the API level. I've heard about some dates (between 2008 and 2014) where the API doesn't show correct data. That might be the case, but it might be due to the API and not the connector itself.

jeffresnick commented 6 years ago

Hi Miguel,

It looks like there are not even close to the right amount of rows for the DailyVideoStats table. When I look at particular dates, there are only a small amount of rows with video data which makes the count off significantly. Any idea as to why it may not get back all of the rows?

Thanks for your help, Jeff

On Sat, Sep 15, 2018 at 8:53 PM Miguel Escobar notifications@github.com wrote:

Hey,

Just wanted to follow up on this. Were you able to find out where the differences came from? From a code standpoint, the calls are correct, but maybe there was a glitch at the API and some views are not accounted for at the API level. I've heard about some dates (between 2008 and 2010) where the API doesn't show correct data. That might be the case, but it might be due to the API and not the connector itself.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/migueesc123/YoutubeAnalytics/issues/12#issuecomment-421663729, or mute the thread https://github.com/notifications/unsubscribe-auth/AopfEvWxVhzHXP6jfv-A7Z1_1Ly-v3oIks5ubaEggaJpZM4WIXVm .

jeffresnick commented 6 years ago

And this is for dates more recent than 2014. For example, if I look at October 6, 2016, I see 9 rows returned in the table, but there are easily 50+ videos that show that they were viewed on that day, so I'm not sure why they aren't added to the table.

On Thu, Sep 20, 2018 at 2:43 PM Jeff Resnick resnickjw@gmail.com wrote:

Hi Miguel,

It looks like there are not even close to the right amount of rows for the DailyVideoStats table. When I look at particular dates, there are only a small amount of rows with video data which makes the count off significantly. Any idea as to why it may not get back all of the rows?

Thanks for your help, Jeff

On Sat, Sep 15, 2018 at 8:53 PM Miguel Escobar notifications@github.com wrote:

Hey,

Just wanted to follow up on this. Were you able to find out where the differences came from? From a code standpoint, the calls are correct, but maybe there was a glitch at the API and some views are not accounted for at the API level. I've heard about some dates (between 2008 and 2010) where the API doesn't show correct data. That might be the case, but it might be due to the API and not the connector itself.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/migueesc123/YoutubeAnalytics/issues/12#issuecomment-421663729, or mute the thread https://github.com/notifications/unsubscribe-auth/AopfEvWxVhzHXP6jfv-A7Z1_1Ly-v3oIks5ubaEggaJpZM4WIXVm .

migueesc123 commented 5 years ago

Closing the ticket. Can't replicate scenario and new API restrictions obfuscate a way to find the root cause of the issue.