I was asked to implement support for downloading videos from tiktok.
I've created a separate branch for that purpose. I don't consider it to be merged to master (at least with current implementation), so I'll keep it here for now.
To use it you need to set specific version of library in maven/gradle:
and update code to init YoutubeDownloader differently, but rest of the code will remain same as for youtube videos:
// NEW PART: init downloader with new TitkotParserImpl
Config config = Config.buildDefault();
DownloaderImpl downloader = new DownloaderImpl(config);
TitkotParserImpl tiktokParser = new TitkotParserImpl(config, downloader, new TiktokExtractorImpl());
YoutubeDownloader youtubeDownloader = new YoutubeDownloader(config, downloader, tiktokParser);
// during request video info pass full video link (NOT just id) as videoId
RequestVideoInfo videoInfoRequest = new RequestVideoInfo("https://www.tiktok.com/@{username}/video/{id}");
Response<VideoInfo> videoInfoResponse = youtubeDownloader.getVideoInfo(videoInfoRequest);
VideoInfo videoInfo = videoInfoResponse.data();
// data format is mostly unchanged, but not all information is present as in youtube video
System.out.println(videoInfo.details().title());
System.out.println(videoInfo.details().viewCount());
List<Format> formats = videoInfo.formats();
for (Format format : formats) {
System.out.println(format.url());
RequestVideoFileDownload videoDownloadRequest = new RequestVideoFileDownload(format);
Response<File> downloadedFile = youtubeDownloader.downloadVideoFile(videoDownloadRequest);
System.out.println("downloaded: " + downloadedFile.data().getName());
}
If you want to download video by format.url() in other way (not with YoutubeDonwloader), you will need to add cookies to you download request, you can get them from Config instance:
I was asked to implement support for downloading videos from tiktok. I've created a separate branch for that purpose. I don't consider it to be merged to master (at least with current implementation), so I'll keep it here for now.
To use it you need to set specific version of library in maven/gradle:
or
and update code to init
YoutubeDownloader
differently, but rest of the code will remain same as for youtube videos:If you want to download video by
format.url()
in other way (not with YoutubeDonwloader), you will need to add cookies to you download request, you can get them from Config instance: