mirror of https://github.com/FongMi/TV.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
1.2 KiB
31 lines
1.2 KiB
package com.github.kiulian.downloader;
|
|
|
|
import com.github.kiulian.downloader.cipher.CachedCipherFactory;
|
|
import com.github.kiulian.downloader.downloader.Downloader;
|
|
import com.github.kiulian.downloader.downloader.DownloaderImpl;
|
|
import com.github.kiulian.downloader.downloader.request.RequestVideoInfo;
|
|
import com.github.kiulian.downloader.downloader.response.Response;
|
|
import com.github.kiulian.downloader.extractor.ExtractorImpl;
|
|
import com.github.kiulian.downloader.model.videos.VideoInfo;
|
|
import com.github.kiulian.downloader.parser.Parser;
|
|
import com.github.kiulian.downloader.parser.ParserImpl;
|
|
|
|
import okhttp3.OkHttpClient;
|
|
|
|
public class YoutubeDownloader {
|
|
|
|
private final Parser parser;
|
|
|
|
public YoutubeDownloader(OkHttpClient client) {
|
|
this(Config.buildDefault(), client);
|
|
}
|
|
|
|
public YoutubeDownloader(Config config, OkHttpClient client) {
|
|
Downloader downloader = new DownloaderImpl(config, client);
|
|
this.parser = new ParserImpl(config, downloader, new ExtractorImpl(downloader), new CachedCipherFactory(downloader));
|
|
}
|
|
|
|
public Response<VideoInfo> getVideoInfo(RequestVideoInfo request) {
|
|
return parser.parseVideo(request);
|
|
}
|
|
}
|
|
|