本文整理匯總了Java中org.schabi.newpipe.extractor.stream.StreamExtractor類的典型用法代碼示例。如果您正苦於以下問題:Java StreamExtractor類的具體用法?Java StreamExtractor怎麽用?Java StreamExtractor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
StreamExtractor類屬於org.schabi.newpipe.extractor.stream包,在下文中一共展示了StreamExtractor類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: main
import org.schabi.newpipe.extractor.stream.StreamExtractor; //導入依賴的package包/類
public static void main(String argv[]) {
if(argv.length == 0) {
System.err.println("please provide a youtube url as first parameter.");
return;
}
String url = argv[0];
//first we need to set the Downloader, so NewPipe knows how to get the files
NewPipe.init(initDownloader());
try {
StreamingService youtube = NewPipe.getService("Youtube");
StreamExtractor extractor = youtube.getStreamExtractorInstance(url);
// actual extraction
StreamInfo streamInfo = StreamInfo.getVideoInfo(extractor);
// if non critical exceptions happened during extraction they will be printed now
for(Throwable error : streamInfo.errors) {
System.err.println("----------------");
error.printStackTrace();
}
// now print the stream url and we are done
for(VideoStream stream : streamInfo.video_streams) {
if(stream.resolution.contains("320p") ||
stream.resolution.contains("720p") ||
stream.resolution.contains("360p")) {
System.out.print(stream.url);
return;
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例2: getRelatedVideosOrLogError
import org.schabi.newpipe.extractor.stream.StreamExtractor; //導入依賴的package包/類
public static List<InfoItem> getRelatedVideosOrLogError(StreamInfo info, StreamExtractor extractor) {
StreamInfoItemCollector collector;
try {
collector = extractor.getRelatedVideos();
} catch (Exception e) {
info.addError(e);
return Collections.emptyList();
}
// Get from collector
return getInfoItems(info, collector);
}
示例3: getStreamExtractor
import org.schabi.newpipe.extractor.stream.StreamExtractor; //導入依賴的package包/類
@Override
public StreamExtractor getStreamExtractor(String url) throws IOException, ExtractionException {
return new SoundcloudStreamExtractor(this, url);
}
示例4: getStreamExtractor
import org.schabi.newpipe.extractor.stream.StreamExtractor; //導入依賴的package包/類
@Override
public StreamExtractor getStreamExtractor(String url) throws IOException, ExtractionException {
return new YoutubeStreamExtractor(this, url);
}
示例5: testGetValidTimeStamp
import org.schabi.newpipe.extractor.stream.StreamExtractor; //導入依賴的package包/類
@Test
public void testGetValidTimeStamp() throws IOException, ExtractionException {
StreamExtractor extractor = SoundCloud.getService().getStreamExtractor("https://soundcloud.com/liluzivert/do-what-i-want-produced-by-maaly-raw-don-cannon#t=69");
assertEquals(extractor.getTimeStamp() + "", "69");
}
示例6: testGetValidTimeStamp
import org.schabi.newpipe.extractor.stream.StreamExtractor; //導入依賴的package包/類
@Test
public void testGetValidTimeStamp() throws IOException, ExtractionException {
StreamExtractor extractor = YouTube.getService().getStreamExtractor("https://youtu.be/FmG385_uUys?t=174");
assertEquals(extractor.getTimeStamp() + "", "174");
}
示例7: getStreamExtractor
import org.schabi.newpipe.extractor.stream.StreamExtractor; //導入依賴的package包/類
public abstract StreamExtractor getStreamExtractor(String url) throws IOException, ExtractionException;