當前位置: 首頁>>代碼示例>>Java>>正文


Java StreamExtractor類代碼示例

本文整理匯總了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();
    }
}
 
開發者ID:TeamNewPipe,項目名稱:np-cli,代碼行數:38,代碼來源:GetStreamUrl.java

示例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);
}
 
開發者ID:TeamNewPipe,項目名稱:NewPipeExtractor,代碼行數:12,代碼來源:ExtractorHelper.java

示例3: getStreamExtractor

import org.schabi.newpipe.extractor.stream.StreamExtractor; //導入依賴的package包/類
@Override
public StreamExtractor getStreamExtractor(String url) throws IOException, ExtractionException {
    return new SoundcloudStreamExtractor(this, url);
}
 
開發者ID:TeamNewPipe,項目名稱:NewPipeExtractor,代碼行數:5,代碼來源:SoundcloudService.java

示例4: getStreamExtractor

import org.schabi.newpipe.extractor.stream.StreamExtractor; //導入依賴的package包/類
@Override
public StreamExtractor getStreamExtractor(String url) throws IOException, ExtractionException {
    return new YoutubeStreamExtractor(this, url);
}
 
開發者ID:TeamNewPipe,項目名稱:NewPipeExtractor,代碼行數:5,代碼來源:YoutubeService.java

示例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");
}
 
開發者ID:TeamNewPipe,項目名稱:NewPipeExtractor,代碼行數:6,代碼來源:SoundcloudStreamExtractorDefaultTest.java

示例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");
}
 
開發者ID:TeamNewPipe,項目名稱:NewPipeExtractor,代碼行數:6,代碼來源:YoutubeStreamExtractorRestrictedTest.java

示例7: getStreamExtractor

import org.schabi.newpipe.extractor.stream.StreamExtractor; //導入依賴的package包/類
public abstract StreamExtractor getStreamExtractor(String url) throws IOException, ExtractionException; 
開發者ID:TeamNewPipe,項目名稱:NewPipeExtractor,代碼行數:2,代碼來源:StreamingService.java


注:本文中的org.schabi.newpipe.extractor.stream.StreamExtractor類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。