{"id":22401728,"url":"https://github.com/blackhatdevx/youtube-downloader-api-springboot","last_synced_at":"2026-05-01T12:33:02.545Z","repository":{"id":264685461,"uuid":"893552031","full_name":"BlackHatDevX/Youtube-Downloader-API-SpringBoot","owner":"BlackHatDevX","description":"This project is a Spring Boot application that provides an API for downloading YouTube videos and serving them via HTTP. It uses the powerful yt-dlp tool to fetch video files and processes them to ensure safe and clean file names.","archived":false,"fork":false,"pushed_at":"2024-11-25T18:23:57.000Z","size":12,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-13T01:35:10.526Z","etag":null,"topics":["api","backend","downloader","java","server","spring-boot","springboot","youtube","youtube-api","youtube-dl","youtube-downloader","ytdl"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BlackHatDevX.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-24T18:24:47.000Z","updated_at":"2025-02-03T14:58:33.000Z","dependencies_parsed_at":"2024-11-25T19:29:56.101Z","dependency_job_id":"efa72888-473b-47a6-90f4-c3bf6c737345","html_url":"https://github.com/BlackHatDevX/Youtube-Downloader-API-SpringBoot","commit_stats":null,"previous_names":["blackhatdevx/youtube-downloader-api-springboot"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/BlackHatDevX/Youtube-Downloader-API-SpringBoot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlackHatDevX%2FYoutube-Downloader-API-SpringBoot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlackHatDevX%2FYoutube-Downloader-API-SpringBoot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlackHatDevX%2FYoutube-Downloader-API-SpringBoot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlackHatDevX%2FYoutube-Downloader-API-SpringBoot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BlackHatDevX","download_url":"https://codeload.github.com/BlackHatDevX/Youtube-Downloader-API-SpringBoot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlackHatDevX%2FYoutube-Downloader-API-SpringBoot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274390644,"owners_count":25276406,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-09T02:00:10.223Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","backend","downloader","java","server","spring-boot","springboot","youtube","youtube-api","youtube-dl","youtube-downloader","ytdl"],"created_at":"2024-12-05T09:07:47.802Z","updated_at":"2026-05-01T12:33:02.504Z","avatar_url":"https://github.com/BlackHatDevX.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# YouTube Video Downloader API\n\nThis project is a Spring Boot application that provides an API for downloading YouTube videos and serving them via HTTP. It uses the powerful `yt-dlp` tool to fetch video files and processes them to ensure safe and clean file names.\n\n## Features\n\n- **Download YouTube Videos**: Provide a YouTube video URL, and the application downloads the video to a local directory.\n- **Safe File Names**: Automatically sanitizes file names by removing invalid characters, keeping only alphanumeric characters to ensure compatibility with URLs and file systems.\n- **Serve Files via API**: Downloaded videos can be accessed via a REST endpoint.\n\n## Requirements\n\nBefore running this application, ensure you have:\n\n- Java 17 or later\n- Spring Boot\n- `yt-dlp` installed and available in your system's PATH\n  (\n\n`brew install yt-dlp`\nOR\n`pip install yt-dlp`\nOR\n`pip3 install yt-dlp`\n\n## Endpoints\n\n### 1. Download Video\n\n**Endpoint**: `/api/youtube/download`  \n**Method**: `GET`  \n**Parameters**:\n\n- `url` (required): The YouTube video URL\n\n**Example Request**:\n\n```http\nGET http://localhost:8080/api/youtube/download?url=https://www.youtube.com/watch?v=example\n```\n\n**Response**:\n\n- On success: Returns a message with a download link.\n- On failure: Returns an error message.\n\n---\n\n### 2. Serve File\n\n**Endpoint**: `/api/youtube/file/{fileName}`  \n**Method**: `GET`\n\n**Example Request**:\n\n```http\nGET http://localhost:8080/api/youtube/file/examplevideo.mp4\n```\n\n**Response**:\n\n- Returns the requested video file for download, or a `404` status if the file is not found.\n\n---\n\n## How It Works\n\n1. **Download Directory**: Videos are downloaded to the `downloads/` folder in the project directory.\n2. **File Name Sanitization**: File names are sanitized to include only alphanumeric characters by removing spaces, special symbols, and emojis.\n3. **Serving Files**: Files are served using Spring's `FileSystemResource`.\n\n## Running the Project\n\n1. Clone the repository:\n\n   ```bash\n   git clone https://github.com/BlackHatDevX/youtube-downloader-api-springboot.git\n   cd youtube-downloader-api-springboot\n   ```\n\n2. Start the application:\n\n   ```bash\n   ./mvnw spring-boot:run\n   ```\n\n3. Make API requests using tools like Postman, Curl, or directly via the browser.\n\n## Sanitization Logic\n\nThe application ensures that all file names:\n\n- Contain only letters (`a-z`, `A-Z`) and numbers (`0-9`).\n- Exclude spaces, special characters, and emojis.\n\nThis prevents issues with URLs and file systems while ensuring compatibility across different platforms.\n\n## Example Output\n\n**Input File Name**: `My Video Title - YouTube 😎.mp4`  \n**Sanitized File Name**: `MyVideoTitleYouTube.mp4`\n\n## License\n\nThis project is licensed under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblackhatdevx%2Fyoutube-downloader-api-springboot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblackhatdevx%2Fyoutube-downloader-api-springboot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblackhatdevx%2Fyoutube-downloader-api-springboot/lists"}