本文整理了Java中org.loklak.harvester.YoutubeScraper.<init>()
方法的一些代码示例,展示了YoutubeScraper.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YoutubeScraper.<init>()
方法的具体详情如下:
包路径:org.loklak.harvester.YoutubeScraper
类名称:YoutubeScraper
方法名:<init>
暂无
代码示例来源:origin: loklak/loklak_server
scraperObj = new YoutubeScraper(inputMap);
scraperObjList.add(scraperObj);
代码示例来源:origin: loklak/loklak_server
@Test
public void apiPathTest() {
YoutubeScraper ytubeScrape = new YoutubeScraper();
assertEquals("/api/youtubescraper.json", ytubeScrape.getAPIPath());
}
代码示例来源:origin: loklak/loklak_server
/**
* When try parse video from buffered reader should check that method return valid json.
*
* @throws IOException if some error happened with open stream for reading data.
*/
@Test
public void parseFromBufferedReaderTest() throws IOException {
YoutubeScraper ytubeScrape = new YoutubeScraper();
String url = "https://www.youtube.com/watch?v=KVGRN7Z7T1A";
String postType = "video";
String postScraper = "youtube";
try {
//Check Network issue
BufferedReader br = new BufferedReader(new InputStreamReader((new URL(url)).openStream(), StandardCharsets.UTF_8));
Post video = ytubeScrape.parseVideo(br, "url", "https://www.youtube.com/watch?v=KVGRN7Z7T1A");
DAO.log(video.toString());
assertThat(video.get("html_title").toString(), is("[\"Iggy Azalea - Team (Explicit) - YouTube\"]"));
assertThat(video.get("post_type"), is(postType));
assertThat(video.get("post_scraper"), is(postScraper));
} catch (IOException e) {
DAO.log("YoutubeScraperTest.parseFromBufferedReaderTest()() failed to connect to network. url:" + url);
}
}
}
代码示例来源:origin: loklak/loklak_server
/**
* When try parse video from input stream should check that video parsed.
*
* @throws IOException if some problem with open stream for reading data.
*/
@Test
public void parseFromInputStreamTest() throws IOException {
YoutubeScraper ytubeScrape = new YoutubeScraper();
String url = "https://www.youtube.com/watch?v=KVGRN7Z7T1A";
InputStream fis = null;
try {
fis = new URL(url).openStream();
Post video = ytubeScrape.parseVideo(fis, "url", url);
DAO.log(video.toString());
assertThat(video.get("html_title").toString(), is("[\"Iggy Azalea - Team (Explicit) - YouTube\"]"));
} catch (IOException e) {
DAO.log("YoutubeScraperTest.parseFromInputStreamTest() failed to connect to network. url:" + url);
}
}
内容来源于网络,如有侵权,请联系作者删除!