https://github.com/gaeqs/javayoutubedownloader
A simple but powerful Youtube Download API for Java.
https://github.com/gaeqs/javayoutubedownloader
downloader java video youtube
Last synced: 7 months ago
JSON representation
A simple but powerful Youtube Download API for Java.
- Host: GitHub
- URL: https://github.com/gaeqs/javayoutubedownloader
- Owner: gaeqs
- License: mit
- Created: 2019-06-19T14:12:25.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-06-17T09:35:52.000Z (over 3 years ago)
- Last Synced: 2025-04-08T05:13:36.511Z (10 months ago)
- Topics: downloader, java, video, youtube
- Language: Java
- Homepage: https://gaeqs.github.io/projects/JavaYoutubeDownloader/
- Size: 114 KB
- Stars: 35
- Watchers: 5
- Forks: 4
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# JavaYoutubeDownloader
A simple but powerful Youtube Download API for Java.
What is JYD?
JavaYoutubeDownloader is a small and simple Youtube Stream downloader
that allows you to download or use any video on the platform in a
few lines.
Installation
You can easily install JYD using maven:
```xml
io.github.gaeqs
JavaYoutubeDownloader
LATEST
```
Usage
Using JYD is very easy! This is an example of a method that downloads a video and saves the option with
the best video quality into a file:
```java
public static boolean download(String url, File folder) {
//Extracts and decodes all streams.
YoutubeVideo video = JavaYoutubeDownloader.decodeOrNull(url, MultipleDecoderMethod.AND, "html", "embedded");
//Gets the option with the greatest quality that has video and audio.
StreamOption option = video.getStreamOptions().stream()
.filter(target -> target.getType().hasVideo() && target.getType().hasAudio())
.min(Comparator.comparingInt(o -> o.getType().getVideoQuality().ordinal())).orElse(null);
//If there is no option, returns false.
if (option == null) return false;
//Prints the option type.
System.out.println(option.getType());
//Creates the file. folder/title.extension
File file = new File(folder, video.getTitle() + "." + option.getType().getContainer().toString().toLowerCase());
//Creates the downloader.
StreamDownloader downloader = new StreamDownloader(option, file, null);
//Runs the downloader.
new Thread(downloader).start();
return true;
}
```