opt in YoutubeAPI
This commit is contained in:
parent
a0b0ce6bfb
commit
9d1d73137e
|
@ -101,10 +101,13 @@ public class YoutubeAPI {
|
|||
private Crawler.Video getVid(JSONObject json) {
|
||||
String vdid = json.getString("id");
|
||||
JSONObject snippet = json.getJSONObject("snippet");
|
||||
String title = snippet.getString("title"); //maxlen: 100
|
||||
long published = getDate(snippet.getString("publishedAt"));
|
||||
String channel = snippet.getString("channelTitle");
|
||||
String tags = snippet.getJSONArray("tags").toList().stream().map(o -> (String) o).collect(Collectors.joining(",")); // max len: ~500
|
||||
String title = snippet.optString("title", ""); //maxlen: 100
|
||||
long published = getDate(snippet.optString("publishedAt", ""));
|
||||
String channel = snippet.optString("channelTitle", "");
|
||||
|
||||
String tags = "";
|
||||
if(snippet.optJSONArray("tags") != null)
|
||||
tags = snippet.getJSONArray("tags").toList().stream().map(o -> (String) o).collect(Collectors.joining(",")); // max len: ~500
|
||||
|
||||
byte category = 0;
|
||||
try {
|
||||
|
@ -112,7 +115,7 @@ public class YoutubeAPI {
|
|||
} catch(NumberFormatException e) {}
|
||||
|
||||
JSONObject contentDetails = json.getJSONObject("contentDetails");
|
||||
int duration = (int) getDuration(contentDetails.getString("duration"));
|
||||
int duration = (int) getDuration(contentDetails.optString("duration", ""));
|
||||
boolean live = !snippet.getString("liveBroadcastContent").equalsIgnoreCase("none");
|
||||
|
||||
String langCode = snippet.optString("defaultLanguage", snippet.optString("defaultAudioLanguage", ""));
|
||||
|
|
Loading…
Reference in New Issue