gpt4 book ai didi

at.huber.youtubeExtractor.YouTubeExtractor.extract()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-15 09:57:31 25 4
gpt4 key购买 nike

本文整理了Java中at.huber.youtubeExtractor.YouTubeExtractor.extract()方法的一些代码示例,展示了YouTubeExtractor.extract()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YouTubeExtractor.extract()方法的具体详情如下:
包路径:at.huber.youtubeExtractor.YouTubeExtractor
类名称:YouTubeExtractor
方法名:extract

YouTubeExtractor.extract介绍

[英]Start the extraction.
[中]开始提取。

代码示例

代码示例来源:origin: Ashish-Bansal/OneTapVideoDownload

public static void startParsing(final Context context, String param, final Invokable<Video, Integer> invokable) {
    YouTubeExtractor mYoutubeExtractor = new YouTubeExtractor(context) {
      @Override
      public void onExtractionComplete(SparseArray<YtFile> ytFiles, VideoMeta vMeta) {
        if (ytFiles != null) {
          YoutubeVideo video = new YoutubeVideo(vMeta.getTitle(), vMeta.getVideoId());
          for(Pair p : YoutubeVideo.itagQualityMapping) {
            YtFile videoFormat = ytFiles.get(Integer.parseInt(p.first.toString()));
            if (videoFormat == null) {
              continue;
            }
            video.addFormat(videoFormat.getUrl(), Integer.parseInt(p.first.toString()));
          }

          try {
            invokable.invoke(video);
          } catch (java.lang.Exception e) {
            FirebaseCrash.report(e);
            e.printStackTrace();
          }
        } else {
          Log.e(TAG, "URLs are empty");
        }
      }
    };

    Log.v(TAG, YOUTUBE_URL_PREFIX + param);
    mYoutubeExtractor.extract(YOUTUBE_URL_PREFIX + param, false, true);
  }
}

代码示例来源:origin: HaarigerHarald/android-youtubeExtractor

@Override
  public void run() {
    final YouTubeExtractor ytEx = new YouTubeExtractor(getInstrumentation()
        .getTargetContext()) {
      @Override
      public void  onExtractionComplete(SparseArray<YtFile> ytFiles, VideoMeta videoMeta) {
        assertEquals(expMeta.getVideoId(), videoMeta.getVideoId());
        assertEquals(expMeta.getTitle(),videoMeta.getTitle());
        assertEquals(expMeta.getAuthor(), videoMeta.getAuthor());
        assertEquals(expMeta.getChannelId(), videoMeta.getChannelId());
        assertEquals(expMeta.getVideoLength(), videoMeta.getVideoLength());
        assertNotSame(0, videoMeta.getViewCount());
        assertNotNull(ytFiles);
        int itag = ytFiles.keyAt(new Random().nextInt(ytFiles.size()));
        testUrl = ytFiles.get(itag).getUrl();
        Log.d(EXTRACTOR_TEST_TAG, "Testing itag: " + itag +", url:" + testUrl);
        signal.countDown();
      }
    };
    ytEx.extract(youtubeLink, false, true);
  }
});

代码示例来源:origin: HaarigerHarald/android-youtubeExtractor

@Override
  public void run() {
    final YouTubeExtractor ytEx = new YouTubeExtractor(getInstrumentation()
        .getTargetContext()) {
      @Override
      public void onExtractionComplete(SparseArray<YtFile> ytFiles, VideoMeta videoMeta) {
        assertNotNull(ytFiles);
        int numNotDash = 0;
        int itag;
        for (int i = 0; i < ytFiles.size(); i++) {
          itag = ytFiles.keyAt(i);
          if (ytFiles.get(itag).getFormat().isDashContainer()) {
            numNotDash = i;
            break;
          }
        }
        itag = ytFiles.keyAt(new Random().nextInt(ytFiles.size() - numNotDash) + numNotDash);
        testUrl = ytFiles.get(itag).getUrl();
        Log.d(EXTRACTOR_TEST_TAG, "Testing itag: " + itag +", url:" + testUrl);
        signal.countDown();
      }
    };
    ytEx.extract(youtubeLink, true, true);
  }
});

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com