Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

16
LINES

< > BotCompany Repo | #1009899 // youTubeStats

JavaX fragment (include)

sclass YouTubeStats {
  long subs, views, videos;
}

static YouTubeStats youTubeStats(S channel) {
  channel = assertNempty(parseYouTubeChannel(channel));
  S url ="https://www.googleapis.com/youtube/v3/channels?part=statistics&id=\*channel*/&key=" + youTubeDataAPIKey();
  Map map = cast loadJSONPage(url);
  L items = cast map.get("items");
  Map item = cast first(items);
  Map statistics = cast item.get("statistics");
  ret nu(YouTubeStats,
    subs := toLong(statistics.get('subscriberCount)),
    views := toLong(statistics.get('viewCount)),
    videos := toLong(statistics.get('videoCount));
}

Author comment

Began life as a copy of #1009893

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1009899
Snippet name: youTubeStats
Eternal ID of this version: #1009899/1
Text MD5: c95b4e6d5edfe3d1ea6969f174bca0d5
Author: stefan
Category: javax / networking
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-08-23 23:06:19
Source code size: 616 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 377 / 421
Referenced in: [show references]