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

16
LINES

< > BotCompany Repo | #1009899 // youTubeStats

JavaX fragment (include)

1  
sclass YouTubeStats {
2  
  long subs, views, videos;
3  
}
4  
5  
static YouTubeStats youTubeStats(S channel) {
6  
  channel = assertNempty(parseYouTubeChannel(channel));
7  
  S url ="https://www.googleapis.com/youtube/v3/channels?part=statistics&id=\*channel*/&key=" + youTubeDataAPIKey();
8  
  Map map = cast loadJSONPage(url);
9  
  L items = cast map.get("items");
10  
  Map item = cast first(items);
11  
  Map statistics = cast item.get("statistics");
12  
  ret nu(YouTubeStats,
13  
    subs := toLong(statistics.get('subscriberCount)),
14  
    views := toLong(statistics.get('viewCount)),
15  
    videos := toLong(statistics.get('videoCount));
16  
}

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: 462 / 503
Referenced in: [show references]