Skip to content

Commit

Permalink
Subscribers list is unfeasible at this stage. Removed the subscirbers…
Browse files Browse the repository at this point in the history
… function
  • Loading branch information
migueesc123 committed Jun 15, 2017
1 parent defb427 commit e609361
Showing 1 changed file with 13 additions and 25 deletions.
38 changes: 13 additions & 25 deletions YoutubeAnalytics/YoutubeAnalytics.pq
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,26 @@ scopes = {


[DataSource.Kind="YoutubeAnalytics", Publish="YoutubeAnalytics.Publish"]
shared YoutubeAnalytics.Navigation = Value.ReplaceType(Navigation, NavigationType);

shared YoutubeAnalytics.Navigation = () =>
NavigationType = type function () as table meta [
Documentation.Name = "Youtube Analytics",
Documentation.LongDescription = "Returns a table with key Youtube Data API and Youtube Analytics API data",
Documentation.Examples = {[
Description = "Returns a table with key Youtube Data API and Youtube Analytics API data",
Code = "YoutubeAnalytics.Navigation () ",
Result = "A table with key Youtube Data API and Youtube Analytics API data"
]}
]
;

Navigation = () =>
let
objects = #table(
{"Name", "Key", "Data", "ItemKind", "ItemName", "IsLeaf"},{
{"Channel", "YoutubeAnalytics.ChannelInfo", YoutubeAnalytics.ChannelInfo(), "Table", "Table", true},
{"Videos", "YoutubeAnalytics.Videos", YoutubeAnalytics.Videos(), "Table", "Table", true},
{"Countries", "YoutubeAnalytics.Countries", YoutubeAnalytics.Countries(), "Table", "Table", true},
{"Subscribers", "YoutubeAnalytics.Subscribers", YoutubeAnalytics.Subscribers(), "Table", "Table", true},
{"Video Stats", "YoutubeAnalytics.VideoStats", YoutubeAnalytics.VideoStats, "Function", "Function", true},
{"Daily Subscribers", "YoutubeAnalytics.DailySubscribers", YoutubeAnalytics.DailySubscribers, "Function", "Function", true},
{"GET Reports", "YoutubeAnalytics.GETReports", YoutubeAnalytics.GETReports, "Function", "Function", true},
Expand Down Expand Up @@ -367,29 +378,6 @@ each [nextPageToken] <> null or [prevPageToken] <> null or [Counter] <= 1 ,
in
#"Changed Type12";

[DataSource.Kind="YoutubeAnalytics"]
YoutubeAnalytics.Subscribers = () =>
let
///Code originally created by Imke http://www.thebiccountant.com/
Baseurl = "https://www.googleapis.com/youtube/v3/subscriptions?part=subscriberSnippet&maxResults=50&mySubscribers=true&pageToken=",
Source = List.Generate( ()=>
[Result = null , nextPageToken =null, prevPageToken= null, Counter = 0],
each [nextPageToken] <> null or [prevPageToken] <> null or [Counter] <= 1 ,
each [Result = if [nextPageToken] = null and [prevPageToken] = null then
Json.Document(
Web.Contents(
Baseurl))
else Json.Document(
Web.Contents(
Baseurl& [nextPageToken])),
nextPageToken = try Result[nextPageToken] otherwise null,
prevPageToken = try Result[prevPageToken] otherwise null,
Counter = [Counter] + 1 ], each [Result]),
#"Removed Top Items" = List.Skip(Source,1)
///End of Imke's code. Please visit her page! http://www.thebiccountant.com/
in
#"Removed Top Items";

// Data Source Kind description
YoutubeAnalytics = [
Authentication = [
Expand Down

0 comments on commit e609361

Please sign in to comment.