This commit is contained in:
Reeverflow
2026-02-16 21:42:13 +01:00
parent cbed4362a8
commit 8182665de9
4 changed files with 9 additions and 7 deletions

View File

@@ -7,7 +7,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
public class VideoDownloaderApplication { public class VideoDownloaderApplication {
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(VideoDownloaderApplication.class, args);
} }
} }

View File

@@ -5,13 +5,10 @@ import com.example.video_downloader.entity.Video;
import com.example.video_downloader.services.VideoService; import com.example.video_downloader.services.VideoService;
import lombok.Data; import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.server.ResponseStatusException;
import java.util.List; import java.util.List;
import java.util.Optional;
@RestController @RestController
@RequestMapping(path="/video") @RequestMapping(path="/video")
@@ -22,7 +19,7 @@ public class VideoController {
private VideoService videoService; private VideoService videoService;
@Data @Data
private class Response { private static class Response {
private Long id; private Long id;
} }

View File

@@ -5,4 +5,5 @@ import lombok.Data;
@Data @Data
public class SaveNewVideoRequest { public class SaveNewVideoRequest {
private String url; private String url;
} }

View File

@@ -1,6 +1,8 @@
package com.example.video_downloader.services; package com.example.video_downloader.services;
import com.example.video_downloader.repositories.VideoRepository;
import jakarta.annotation.PostConstruct; import jakarta.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.io.IOException; import java.io.IOException;
@@ -9,9 +11,12 @@ import java.nio.charset.StandardCharsets;
@Service @Service
public class ProcessService { public class ProcessService {
@PostConstruct @Autowired
private VideoRepository videoRepository;
//@PostConstruct
public void init() throws InterruptedException, IOException { public void init() throws InterruptedException, IOException {
execute("yt-dlp", ""); execute("yt-dlp", "youtube:player_client=android", "");
} }
public void execute(String... command) throws InterruptedException, IOException { public void execute(String... command) throws InterruptedException, IOException {