aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/Downloader.java
diff options
context:
space:
mode:
authorPinapelz <yukais@pinapelz.com>2025-10-15 17:02:17 -0700
committerPinapelz <yukais@pinapelz.com>2025-10-15 17:02:17 -0700
commit5f0c90afdd30f97a2f941053e62527c362babd60 (patch)
tree01c628c22d0a03ced35913454e66e3d5b84a0f22 /src/main/java/Downloader.java
parent32c50bcc4d77e72f2b4af5f0778574fdd9b19dfd (diff)
fix: regular full video download (youtube block), added cookie extraction from browser
Diffstat (limited to 'src/main/java/Downloader.java')
-rw-r--r--src/main/java/Downloader.java9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/main/java/Downloader.java b/src/main/java/Downloader.java
index 828d276..6442605 100644
--- a/src/main/java/Downloader.java
+++ b/src/main/java/Downloader.java
@@ -83,7 +83,7 @@ public class Downloader {
/*
Download a part of a video
*/
- public boolean download(String url, String stamp){
+ public boolean download(String url, String stamp, String browser){
ArrayList<String> times = new ArrayList<>(Arrays.asList(stamp.split("-")));
String startTime = times.get(0);
String endTime = times.get(1);
@@ -92,7 +92,7 @@ public class Downloader {
try {
ProcessBuilder builder = new ProcessBuilder(
"yt-dlp",
- "-vU","--force-keyframes",
+ "--force-keyframes",
"-f", "bestaudio[ext=webm]",
"--download-sections","*"+startSec+"-"+endSec,
"-o", "%(title)s[%(id)s].%(ext)s",
@@ -167,10 +167,11 @@ public class Downloader {
return true;
}
- public boolean download(String url){
+ public boolean download(String url, String browser){
String ytDlpExecutable = "yt-dlp" + (System.getProperty("os.name").startsWith("Windows") ? ".exe" : "");
try {
- String[] command = {ytDlpExecutable, "-f", "bestaudio[ext=webm]", "-x", "--audio-format", "mp3", "--write-info-json", url, "-o", "%(title)s[%(id)s].%(ext)s"};
+ String[] command = {ytDlpExecutable, "--min-sleep-interval","2", "--max-sleep-interval", "7","--cookies-from-browser",browser,"-f", "bestaudio[ext=webm]", "-x",
+ "--audio-format", "mp3", "--write-info-json", url, "-o", "%(title)s[%(id)s].%(ext)s"};
ProcessBuilder processBuilder = new ProcessBuilder(command);
processBuilder.directory(new File(System.getProperty("user.dir")));
Process process = processBuilder.start();
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage