Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: sapher/youtubedl-java
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: zkingboos/youtubedl-java
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 15 commits
  • 105 files changed
  • 2 contributors

Commits on Feb 6, 2021

  1. Copy the full SHA
    8f9548d View commit details
  2. Copy the full SHA
    7f95f42 View commit details
  3. updated version

    zkingboos committed Feb 6, 2021
    Copy the full SHA
    d0edaab View commit details
  4. updated readme.md

    zkingboos committed Feb 6, 2021
    Copy the full SHA
    5b64e4a View commit details

Commits on Feb 7, 2021

  1. Copy the full SHA
    5f12f74 View commit details
  2. updated gitignore

    zkingboos committed Feb 7, 2021
    Copy the full SHA
    9e99a14 View commit details
  3. up to 1.1.3

    zkingboos committed Feb 7, 2021
    Copy the full SHA
    83dfc2d View commit details
  4. added docs

    zkingboos committed Feb 7, 2021
    Copy the full SHA
    2eddc61 View commit details
  5. Copy the full SHA
    4adb7fe View commit details
  6. added gradle workflow

    zkingboos committed Feb 7, 2021
    Copy the full SHA
    e6cd583 View commit details
  7. Merge pull request #1 from zkingboos/master

    mirror
    zkingboos authored Feb 7, 2021
    Copy the full SHA
    cfea8b5 View commit details
  8. Update LICENSE

    zkingboos authored Feb 7, 2021
    Copy the full SHA
    e5dd8d2 View commit details
  9. Merge pull request #2 from zkingboos/change-license

    Update LICENSE
    zkingboos authored Feb 7, 2021
    Copy the full SHA
    be39b47 View commit details

Commits on Feb 8, 2021

  1. english phrase

    zkingboos authored Feb 8, 2021
    Copy the full SHA
    bb1e3f8 View commit details
  2. Update LICENSE

    zkingboos authored Feb 8, 2021
    Copy the full SHA
    0753ed4 View commit details
Showing with 14,478 additions and 630 deletions.
  1. +46 −0 .github/workflows/gradle.yml
  2. +122 −7 .gitignore
  3. +0 −5 .travis.yml
  4. +17 −9 LICENSE
  5. +44 −34 README.md
  6. +29 −0 build.gradle
  7. +33 −0 docs/allclasses-frame.html
  8. +33 −0 docs/allclasses-noframe.html
  9. +603 −0 docs/com/github/zkingboos/youtubedl/YoutubeDL.html
  10. +999 −0 docs/com/github/zkingboos/youtubedl/YoutubeOption.html
  11. +380 −0 docs/com/github/zkingboos/youtubedl/YoutubeRequest.html
  12. +360 −0 docs/com/github/zkingboos/youtubedl/YoutubeResponse.html
  13. +226 −0 docs/com/github/zkingboos/youtubedl/callback/DownloadProgressCallback.html
  14. +20 −0 docs/com/github/zkingboos/youtubedl/callback/package-frame.html
  15. +140 −0 docs/com/github/zkingboos/youtubedl/callback/package-summary.html
  16. +131 −0 docs/com/github/zkingboos/youtubedl/callback/package-tree.html
  17. +323 −0 docs/com/github/zkingboos/youtubedl/entry/HttpHeader.html
  18. +20 −0 docs/com/github/zkingboos/youtubedl/entry/package-frame.html
  19. +140 −0 docs/com/github/zkingboos/youtubedl/entry/package-summary.html
  20. +135 −0 docs/com/github/zkingboos/youtubedl/entry/package-tree.html
  21. +259 −0 docs/com/github/zkingboos/youtubedl/entry/playlist/PlaylistInfo.html
  22. +290 −0 docs/com/github/zkingboos/youtubedl/entry/playlist/RawPlaylistInfo.html
  23. +21 −0 docs/com/github/zkingboos/youtubedl/entry/playlist/package-frame.html
  24. +144 −0 docs/com/github/zkingboos/youtubedl/entry/playlist/package-summary.html
  25. +139 −0 docs/com/github/zkingboos/youtubedl/entry/playlist/package-tree.html
  26. +453 −0 docs/com/github/zkingboos/youtubedl/entry/video/VideoFormat.html
  27. +570 −0 docs/com/github/zkingboos/youtubedl/entry/video/VideoInfo.html
  28. +235 −0 docs/com/github/zkingboos/youtubedl/entry/video/VideoSubtitle.html
  29. +284 −0 docs/com/github/zkingboos/youtubedl/entry/video/VideoThumbnail.html
  30. +23 −0 docs/com/github/zkingboos/youtubedl/entry/video/package-frame.html
  31. +152 −0 docs/com/github/zkingboos/youtubedl/entry/video/package-summary.html
  32. +138 −0 docs/com/github/zkingboos/youtubedl/entry/video/package-tree.html
  33. +344 −0 docs/com/github/zkingboos/youtubedl/exception/YoutubeDLException.html
  34. +20 −0 docs/com/github/zkingboos/youtubedl/exception/package-frame.html
  35. +142 −0 docs/com/github/zkingboos/youtubedl/exception/package-summary.html
  36. +143 −0 docs/com/github/zkingboos/youtubedl/exception/package-tree.html
  37. +23 −0 docs/com/github/zkingboos/youtubedl/package-frame.html
  38. +156 −0 docs/com/github/zkingboos/youtubedl/package-summary.html
  39. +141 −0 docs/com/github/zkingboos/youtubedl/package-tree.html
  40. +323 −0 docs/com/github/zkingboos/youtubedl/stream/StreamGobbler.html
  41. +325 −0 docs/com/github/zkingboos/youtubedl/stream/StreamProcessExtractor.html
  42. +21 −0 docs/com/github/zkingboos/youtubedl/stream/package-frame.html
  43. +144 −0 docs/com/github/zkingboos/youtubedl/stream/package-summary.html
  44. +140 −0 docs/com/github/zkingboos/youtubedl/stream/package-tree.html
  45. +122 −0 docs/constant-values.html
  46. +122 −0 docs/deprecated-list.html
  47. +223 −0 docs/help-doc.html
  48. +152 −0 docs/index-files/index-1.html
  49. +129 −0 docs/index-files/index-10.html
  50. +131 −0 docs/index-files/index-11.html
  51. +129 −0 docs/index-files/index-12.html
  52. +141 −0 docs/index-files/index-13.html
  53. +137 −0 docs/index-files/index-14.html
  54. +153 −0 docs/index-files/index-15.html
  55. +129 −0 docs/index-files/index-16.html
  56. +147 −0 docs/index-files/index-17.html
  57. +153 −0 docs/index-files/index-18.html
  58. +135 −0 docs/index-files/index-19.html
  59. +133 −0 docs/index-files/index-2.html
  60. +141 −0 docs/index-files/index-20.html
  61. +147 −0 docs/index-files/index-21.html
  62. +133 −0 docs/index-files/index-22.html
  63. +169 −0 docs/index-files/index-23.html
  64. +141 −0 docs/index-files/index-3.html
  65. +137 −0 docs/index-files/index-4.html
  66. +149 −0 docs/index-files/index-5.html
  67. +153 −0 docs/index-files/index-6.html
  68. +171 −0 docs/index-files/index-7.html
  69. +139 −0 docs/index-files/index-8.html
  70. +139 −0 docs/index-files/index-9.html
  71. +75 −0 docs/index.html
  72. +27 −0 docs/overview-frame.html
  73. +157 −0 docs/overview-summary.html
  74. +176 −0 docs/overview-tree.html
  75. +7 −0 docs/package-list
  76. +30 −0 docs/script.js
  77. +147 −0 docs/serialized-form.html
  78. +574 −0 docs/stylesheet.css
  79. BIN gradle/wrapper/gradle-wrapper.jar
  80. +5 −0 gradle/wrapper/gradle-wrapper.properties
  81. +185 −0 gradlew
  82. +89 −0 gradlew.bat
  83. +0 −52 pom.xml
  84. +5 −0 settings.gradle
  85. +250 −0 src/main/java/com/github/zkingboos/youtubedl/YoutubeDL.java
  86. +344 −0 src/main/java/com/github/zkingboos/youtubedl/YoutubeOption.java
  87. +85 −0 src/main/java/com/github/zkingboos/youtubedl/YoutubeRequest.java
  88. +11 −11 ...a/com/{sapher/youtubedl/YoutubeDLResponse.java → github/zkingboos/youtubedl/YoutubeResponse.java}
  89. +2 −1 ...n/java/com/{sapher/youtubedl → github/zkingboos/youtubedl/callback}/DownloadProgressCallback.java
  90. +7 −1 src/main/java/com/{sapher/youtubedl/mapper → github/zkingboos/youtubedl/entry}/HttpHeader.java
  91. +15 −0 src/main/java/com/github/zkingboos/youtubedl/entry/playlist/PlaylistInfo.java
  92. +33 −0 src/main/java/com/github/zkingboos/youtubedl/entry/playlist/RawPlaylistInfo.java
  93. +7 −1 ...main/java/com/{sapher/youtubedl/mapper → github/zkingboos/youtubedl/entry/video}/VideoFormat.java
  94. +25 −1 src/main/java/com/{sapher/youtubedl/mapper → github/zkingboos/youtubedl/entry/video}/VideoInfo.java
  95. +1 −1 ...in/java/com/{sapher/youtubedl/mapper → github/zkingboos/youtubedl/entry/video}/VideoSubtitle.java
  96. +7 −1 ...n/java/com/{sapher/youtubedl/mapper → github/zkingboos/youtubedl/entry/video}/VideoThumbnail.java
  97. +10 −3 src/main/java/com/{sapher/youtubedl → github/zkingboos/youtubedl/exception}/YoutubeDLException.java
  98. +6 −7 src/main/java/com/{sapher/youtubedl/utils → github/zkingboos/youtubedl/stream}/StreamGobbler.java
  99. +12 −11 ...java/com/{sapher/youtubedl/utils → github/zkingboos/youtubedl/stream}/StreamProcessExtractor.java
  100. +0 −212 src/main/java/com/sapher/youtubedl/YoutubeDL.java
  101. +0 −112 src/main/java/com/sapher/youtubedl/YoutubeDLRequest.java
  102. +0 −35 src/test/java/com/sapher/youtubedl/YoutubeDLRequestTest.java
  103. +0 −12 src/test/java/com/sapher/youtubedl/YoutubeDLResponseTest.java
  104. +0 −104 src/test/java/com/sapher/youtubedl/YoutubeDLTest.java
  105. +0 −10 src/test/java/com/sapher/youtubedl/YoutubeDLTestSuite.java
46 changes: 46 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: 'gradle-workflow'

on:
push:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8

- name: Build gradle project
run: |
gradle clean shadowJar
- name: Setup project version
run: |
export PROJECT_VERSION=$(gradle properties --no-daemon --console=plain -q | grep "^version:" | awk '{printf $2}')
echo "Debug gradle version ${PROJECT_VERSION}"
echo "PROJECT_VERSION=${PROJECT_VERSION}" >> $GITHUB_ENV
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.PROJECT_VERSION }}
release_name: "${{ format('{0} [Release #{1}]', github.event.head_commit.message, github.run_id) }}"
body: |
open in [jitpack.io][jitpack-url]
[jitpack-url]: https://jitpack.io/#${{ github.repository }}/${{ env.PROJECT_VERSION }}
draft: false
prerelease: false

- name: Uploud release assets
uses: AButler/upload-release-assets@v2.0
with:
files: 'build/*.jar'
repo-token: ${{ secrets.GITHUB_TOKEN }}
release-tag: ${{ env.PROJECT_VERSION }}
129 changes: 122 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,22 +1,137 @@
# Created by https://www.toptal.com/developers/gitignore/api/gradle,intellij+all,java
# Edit at https://www.toptal.com/developers/gitignore?templates=gradle,intellij+all,java

### Intellij+all ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

### Intellij+all Patch ###
# Ignores the whole .idea folder and all .iml files
# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360

.idea/

# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023

*.iml
modules.xml
.idea/misc.xml
*.ipr

# Sonarlint plugin
.idea/sonarlint

### Java ###
# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

.idea
*.iml
### Gradle ###
.gradle
build/

# No target build for github
target/
# Ignore Gradle GUI config
gradle-app.setting

# Gradle
.gradle
gradle
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar

# Cache of project
.gradletasknamecache

# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
# gradle/wrapper/gradle-wrapper.properties

### Gradle Patch ###
**/build/

# End of https://www.toptal.com/developers/gitignore/api/gradle,intellij+all,java
5 changes: 0 additions & 5 deletions .travis.yml

This file was deleted.

26 changes: 17 additions & 9 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
MIT License

Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Copyright (c) 2021 ykingboos

Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

0. You just DO WHAT THE FUCK YOU WANT TO.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
78 changes: 44 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,19 @@
# youtubedl-java [![Build Status](https://travis-ci.org/sapher/youtubedl-java.svg?branch=master)](https://travis-ci.org/sapher/youtubedl-java)
# youtubedl-java [![](https://jitpack.io/v/zkingboos/youtubedl-java.svg)](https://jitpack.io/#zkingboos/youtubedl-java)

A simple java wrapper for [youtube-dl](https://github.com/rg3/youtube-dl) executable
An sapher/youtubedl-java's fork with support for playlists, video search and bug fixes.

There's a lot of thing left to do. Parsing output is one of them. Too bad, youtube-dl doesn't output formatted data.

# Prerequisite

:warning: Youtube-dl should be installed and available in your `$PATH.
## Pre requisites
You must have `youtube-dl` installed and available in your $PATH environment variable. You can also add your path dynamically.

[How to properly install YoutubeDL executable](https://rg3.github.io/youtube-dl/download.html)

Otherwise you will get this error :

`Cannot run program "youtube-dl" (in directory "/Users/my/beautiful/path"): error=2, No such file or directory`

# Usage
Otherwise you'll get this error :

## Installation
`Cannot run program "youtube-dl" (in directory "computer's path"): error=2, No such file or directory`

You can use jitpack.io to add the library to your project.
### Installation

[youtube-dl](https://jitpack.io/#sapher/youtubedl-java)
You can use [youtube-dl](https://jitpack.io/#zkingboos/youtubedl-java) jitpack.io repository to add the library to your project.

### Gradle

@@ -38,42 +31,59 @@ allprojects {

```
dependencies {
compile 'com.github.sapher:youtubedl-java:1.+'
implementation 'com.github.zkingboos:youtubedl-java:VERSION'
}
```

## Make request
## Example

```java
// Change environment variables
YoutubeDL.setEnvironmentConsumer(environment -> {
//TODO: manage your environment variables here
});

// Change default youtube-dl command
YoutubeDL.setExecutablePath("cmd.exe", "/c", "youtube-dl"); //example with windows

// Video url to download
String videoUrl = "https://www.youtube.com/watch?v=dQw4w9WgXcQ";
String videoUrl = "https://www.youtube.com/watch?v=dQw4w9WgXcQ"; //to download youtube video url

//or
String videoUrl = "ytsearch1:fantastic music song"; //to search by a video and download it

// Destination directory
String directory = System.getProperty("user.home");

// Build request
YoutubeDLRequest request = new YoutubeDLRequest(videoUrl, directory);
request.setOption("ignore-errors"); // --ignore-errors
request.setOption("output", "%(id)s"); // --output "%(id)s"
request.setOption("retries", 10); // --retries 10
// Build request with video url
YoutubeRequest request = YoutubeDL
.from(videoUrl, directory)
.ignoreErrors() // --ignore-errors
.output("%(id)s") // --output "%(id)s"
.retries(10); // --retries 10

//or build request with search video
YoutubeRequest request = YoutubeDL
.search(videoUrl, directory)
.ignoreErrors() // --ignore-errors
.output("%(id)s") // --output "%(id)s"
.retries(10); // --retries 10

// Make request and return response
YoutubeDLResponse response = YoutubeDL.execute(request);
final YoutubeResponse response = request.build();

// Response
String stdOut = response.getOut(); // Executable output
final String out = response.getOut(); // Executable output
```
> You can also see [youtube-dl options][youtube-dl-options] for more options.
You may also specify a callback to get notified about the progress of the download:

```
...
YoutubeDLResponse response = YoutubeDL.execute(request, new DownloadProgressCallback() {
@Override
public void onProgressUpdate(float progress, long etaInSeconds) {
System.out.println(String.valueOf(progress) + "%");
}
});
YoutubeDLResponse response = YoutubeDL.execute(request, (progress, eta) -> {
System.out.println(progress + "%");
});
```
# Links
* [Youtube-dl documentation](https://github.com/sapher/youtubedl-java)
> `DownloadProgressCallback` will be no longer supported by this project.
[youtube-dl-options]: https://github.com/ytdl-org/youtube-dl#OPTIONS
29 changes: 29 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
plugins {
id 'com.github.johnrengelman.shadow' version '5.2.0'
id 'java'
id 'maven'
}

repositories {
mavenLocal()
maven { url 'https://repo.maven.apache.org/maven2/' }
}

group = 'com.github.zkingboos'
version = '1.1.3'
sourceCompatibility = 1.8

dependencies {
compileOnly 'org.projectlombok:lombok:1.18.16'
annotationProcessor 'org.projectlombok:lombok:1.18.16'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.7.4'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.7.4'
}

tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}

tasks.withType(Jar) {
destinationDirectory.set(file("$rootDir/build/"))
}
Loading