gpt4 book ai didi

at.huber.youtubeExtractor.YtFile类的使用及代码示例

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

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

YtFile介绍

暂无

代码示例

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

@Override
  public void onClick(View v) {
    String filename;
    if (videoTitle.length() > 55) {
      filename = videoTitle.substring(0, 55) + "." + ytfile.getFormat().getExt();
    } else {
      filename = videoTitle + "." + ytfile.getFormat().getExt();
    }
    filename = filename.replaceAll("[\\\\><\"|*?%:#/]", "");
    downloadFromUrl(ytfile.getUrl(), videoTitle, filename);
    finish();
  }
});

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

if(mat.find()){
        int itag = Integer.parseInt(mat.group(1));
        YtFile newFile = new YtFile(FORMAT_MAP.get(itag), line);
        ytFiles.put(itag, newFile);
Format format = FORMAT_MAP.get(itag);
String finalUrl = URLDecoder.decode(url, "UTF-8");
YtFile newVideo = new YtFile(format, finalUrl);
ytFiles.put(itag, newVideo);
    dashMpdUrl = dashMpdUrl.replace("/s/" + encSignatures.get(key), "/signature/" + sigs[i]);
  } else {
    String url = ytFiles.get(key).getUrl();
    url += "&signature=" + sigs[i];
    YtFile newFile = new YtFile(FORMAT_MAP.get(key), url);
    ytFiles.put(key, newFile);

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

@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");
    }
  }
};

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

private void addButtonToMainLayout(final String videoTitle, final YtFile ytfile) {
  // Display some buttons and let the user choose the format
  String btnText = (ytfile.getFormat().getHeight() == -1) ? "Audio " +
      ytfile.getFormat().getAudioBitrate() + " kbit/s" :
      ytfile.getFormat().getHeight() + "p";
  btnText += (ytfile.getFormat().isDashContainer()) ? " dash" : "";
  Button btn = new Button(this);
  btn.setText(btnText);
  btn.setOnClickListener(new OnClickListener() {
    @Override
    public void onClick(View v) {
      String filename;
      if (videoTitle.length() > 55) {
        filename = videoTitle.substring(0, 55) + "." + ytfile.getFormat().getExt();
      } else {
        filename = videoTitle + "." + ytfile.getFormat().getExt();
      }
      filename = filename.replaceAll("[\\\\><\"|*?%:#/]", "");
      downloadFromUrl(ytfile.getUrl(), videoTitle, filename);
      finish();
    }
  });
  mainLayout.addView(btn);
}

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

continue;
YtFile yf = new YtFile(FORMAT_MAP.get(itag), url);
ytFiles.append(itag, yf);

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

private void addFormatToList(YtFile ytFile, SparseArray<YtFile> ytFiles) {
  int height = ytFile.getFormat().getHeight();
  if (height != -1) {
    for (YtFragmentedVideo frVideo : formatsToShowList) {
      if (frVideo.height == height && (frVideo.videoFile == null ||
          frVideo.videoFile.getFormat().getFps() == ytFile.getFormat().getFps())) {
        return;
      }
    }
  }
  YtFragmentedVideo frVideo = new YtFragmentedVideo();
  frVideo.height = height;
  if (ytFile.getFormat().isDashContainer()) {
    if (height > 0) {
      frVideo.videoFile = ytFile;
      frVideo.audioFile = ytFiles.get(ITAG_FOR_AUDIO);
    } else {
      frVideo.audioFile = ytFile;
    }
  } else {
    frVideo.videoFile = ytFile;
  }
  formatsToShowList.add(frVideo);
}

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

@Override
  public void onClick(View v) {
    String filename;
    if (videoTitle.length() > 55) {
      filename = videoTitle.substring(0, 55);
    } else {
      filename = videoTitle;
    }
    filename = filename.replaceAll("[\\\\><\"|*?%:#/]", "");
    filename += (ytFrVideo.height == -1) ? "" : "-" + ytFrVideo.height + "p";
    String downloadIds = "";
    boolean hideAudioDownloadNotification = false;
    if (ytFrVideo.videoFile != null) {
      downloadIds += downloadFromUrl(ytFrVideo.videoFile.getUrl(), videoTitle,
          filename + "." + ytFrVideo.videoFile.getFormat().getExt(), false);
      downloadIds += "-";
      hideAudioDownloadNotification = true;
    }
    if (ytFrVideo.audioFile != null) {
      downloadIds += downloadFromUrl(ytFrVideo.audioFile.getUrl(), videoTitle,
          filename + "." + ytFrVideo.audioFile.getFormat().getExt(), hideAudioDownloadNotification);
    }
    if (ytFrVideo.audioFile != null)
      cacheDownloadIds(downloadIds);
    finish();
  }
});

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

@Override
  public void onExtractionComplete(SparseArray<YtFile> ytFiles, VideoMeta vMeta) {
    mainProgressBar.setVisibility(View.GONE);
    if (ytFiles == null) {
      TextView tv = new TextView(DownloadActivity.this);
      tv.setText(R.string.app_update);
      tv.setMovementMethod(LinkMovementMethod.getInstance());
      mainLayout.addView(tv);
      return;
    }
    formatsToShowList = new ArrayList<>();
    for (int i = 0, itag; i < ytFiles.size(); i++) {
      itag = ytFiles.keyAt(i);
      YtFile ytFile = ytFiles.get(itag);
      if (ytFile.getFormat().getHeight() == -1 || ytFile.getFormat().getHeight() >= 360) {
        addFormatToList(ytFile, ytFiles);
      }
    }
    Collections.sort(formatsToShowList, new Comparator<YtFragmentedVideo>() {
      @Override
      public int compare(YtFragmentedVideo lhs, YtFragmentedVideo rhs) {
        return lhs.height - rhs.height;
      }
    });
    for (YtFragmentedVideo files : formatsToShowList) {
      addButtonToMainLayout(vMeta.getTitle(), files);
    }
  }
}.extract(youtubeLink, true, false);

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

@Override
  public void onExtractionComplete(SparseArray<YtFile> ytFiles, VideoMeta vMeta) {
    mainProgressBar.setVisibility(View.GONE);
    if (ytFiles == null) {
      // Something went wrong we got no urls. Always check this.
      finish();
      return;
    }
    // Iterate over itags
    for (int i = 0, itag; i < ytFiles.size(); i++) {
      itag = ytFiles.keyAt(i);
      // ytFile represents one file with its url and meta data
      YtFile ytFile = ytFiles.get(itag);
      // Just add videos in a decent format => height -1 = audio
      if (ytFile.getFormat().getHeight() == -1 || ytFile.getFormat().getHeight() >= 360) {
        addButtonToMainLayout(vMeta.getTitle(), ytFile);
      }
    }
  }
}.extract(youtubeLink, true, false);

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

btnText = "Audio " + ytFrVideo.audioFile.getFormat().getAudioBitrate() + " kbit/s";
else
  btnText = (ytFrVideo.videoFile.getFormat().getFps() == 60) ? ytFrVideo.height + "p60" :
      ytFrVideo.height + "p";
Button btn = new Button(this);

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