refactor YoutubeAPI
This commit is contained in:
parent
2df0029c18
commit
bdcc276d58
|
@ -38,25 +38,11 @@ public class YoutubeAPI {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public YoutubeAPI() {
|
|
||||||
if(api_key.isEmpty()) {
|
|
||||||
log.error("apikey is not defined!");
|
|
||||||
System.exit(1);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
durationfactory = DatatypeFactory.newInstance();
|
|
||||||
} catch(DatatypeConfigurationException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
System.exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Crawler.Video getInfo(String id) {
|
public Crawler.Video getInfo(String id) {
|
||||||
return (Crawler.Video) getInfos(id)[0].get(0);
|
return getInfos(id)[0].get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Crawler.Video>[] getInfos(List<String> ids) {
|
public List<Crawler.Video>[] getInfos(List<String> ids) {
|
||||||
//log.info("get " + ids.size() + " infos");
|
|
||||||
if(ids.isEmpty())
|
if(ids.isEmpty())
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
@ -174,5 +160,4 @@ public class YoutubeAPI {
|
||||||
return null;
|
return null;
|
||||||
return new JSONObject(new JSONTokener(in));
|
return new JSONObject(new JSONTokener(in));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// no suchelement bla
|
|
Loading…
Reference in New Issue