From 8182665de9cbcfb262007e251192328355a4dcbc Mon Sep 17 00:00:00 2001 From: Reeverflow Date: Mon, 16 Feb 2026 21:42:13 +0100 Subject: [PATCH 01/13] Init --- .../video_downloader/VideoDownloaderApplication.java | 1 - .../video_downloader/controllers/VideoController.java | 5 +---- .../video_downloader/dto/SaveNewVideoRequest.java | 1 + .../video_downloader/services/ProcessService.java | 9 +++++++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/example/video_downloader/VideoDownloaderApplication.java b/src/main/java/com/example/video_downloader/VideoDownloaderApplication.java index 3b61d97..68beb82 100644 --- a/src/main/java/com/example/video_downloader/VideoDownloaderApplication.java +++ b/src/main/java/com/example/video_downloader/VideoDownloaderApplication.java @@ -7,7 +7,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; public class VideoDownloaderApplication { public static void main(String[] args) { - SpringApplication.run(VideoDownloaderApplication.class, args); } } diff --git a/src/main/java/com/example/video_downloader/controllers/VideoController.java b/src/main/java/com/example/video_downloader/controllers/VideoController.java index 86682cd..404546e 100644 --- a/src/main/java/com/example/video_downloader/controllers/VideoController.java +++ b/src/main/java/com/example/video_downloader/controllers/VideoController.java @@ -5,13 +5,10 @@ import com.example.video_downloader.entity.Video; import com.example.video_downloader.services.VideoService; import lombok.Data; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; -import org.springframework.web.server.ResponseStatusException; import java.util.List; -import java.util.Optional; @RestController @RequestMapping(path="/video") @@ -22,7 +19,7 @@ public class VideoController { private VideoService videoService; @Data - private class Response { + private static class Response { private Long id; } diff --git a/src/main/java/com/example/video_downloader/dto/SaveNewVideoRequest.java b/src/main/java/com/example/video_downloader/dto/SaveNewVideoRequest.java index bfdf986..ccde4d8 100644 --- a/src/main/java/com/example/video_downloader/dto/SaveNewVideoRequest.java +++ b/src/main/java/com/example/video_downloader/dto/SaveNewVideoRequest.java @@ -5,4 +5,5 @@ import lombok.Data; @Data public class SaveNewVideoRequest { private String url; + } diff --git a/src/main/java/com/example/video_downloader/services/ProcessService.java b/src/main/java/com/example/video_downloader/services/ProcessService.java index 9954489..ecec741 100644 --- a/src/main/java/com/example/video_downloader/services/ProcessService.java +++ b/src/main/java/com/example/video_downloader/services/ProcessService.java @@ -1,6 +1,8 @@ package com.example.video_downloader.services; +import com.example.video_downloader.repositories.VideoRepository; import jakarta.annotation.PostConstruct; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.io.IOException; @@ -9,9 +11,12 @@ import java.nio.charset.StandardCharsets; @Service public class ProcessService { - @PostConstruct + @Autowired + private VideoRepository videoRepository; + + //@PostConstruct public void init() throws InterruptedException, IOException { - execute("yt-dlp", ""); + execute("yt-dlp", "youtube:player_client=android", ""); } public void execute(String... command) throws InterruptedException, IOException { From a39bad0f132f9fc62c7f1d942fd342fdeb966598 Mon Sep 17 00:00:00 2001 From: Reeverflow Date: Tue, 17 Feb 2026 21:42:55 +0100 Subject: [PATCH 02/13] Added video downloading from database url. Added findByStatus, any entry with NEW status in the db will have their url returned. Currently to add entries to the database POSTMAN or other apps need to be used. --- .../VideoDownloaderApplication.java | 1 + .../repositories/VideoRepository.java | 4 +++ .../services/ProcessService.java | 26 +++++++++++++++++-- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/example/video_downloader/VideoDownloaderApplication.java b/src/main/java/com/example/video_downloader/VideoDownloaderApplication.java index 68beb82..3b61d97 100644 --- a/src/main/java/com/example/video_downloader/VideoDownloaderApplication.java +++ b/src/main/java/com/example/video_downloader/VideoDownloaderApplication.java @@ -7,6 +7,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; public class VideoDownloaderApplication { public static void main(String[] args) { + SpringApplication.run(VideoDownloaderApplication.class, args); } } diff --git a/src/main/java/com/example/video_downloader/repositories/VideoRepository.java b/src/main/java/com/example/video_downloader/repositories/VideoRepository.java index 77650f4..84405bb 100644 --- a/src/main/java/com/example/video_downloader/repositories/VideoRepository.java +++ b/src/main/java/com/example/video_downloader/repositories/VideoRepository.java @@ -1,9 +1,13 @@ package com.example.video_downloader.repositories; +import com.example.video_downloader.entity.StatusEnum; import com.example.video_downloader.entity.Video; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; +import java.util.List; + @Repository public interface VideoRepository extends JpaRepository { + List