feat: Add video upload functionality
This commit is contained in:
@@ -9,9 +9,11 @@
|
||||
## 功能特点
|
||||
|
||||
- **视频下载**:通过简单的 URL 输入下载 YouTube 和 Bilibili 视频。
|
||||
- **视频上传**:直接上传本地视频文件到您的库,并自动生成缩略图。
|
||||
- **Bilibili 支持**:支持下载单个视频、多P视频以及整个合集/系列。
|
||||
- **并行下载**:支持队列下载,可同时追踪多个下载任务的进度。
|
||||
- **本地库**:自动保存视频缩略图和元数据,提供丰富的浏览体验。
|
||||
- **视频播放器**:自定义播放器,支持播放/暂停、循环和快进/快退控制。
|
||||
- **搜索功能**:支持在本地库中搜索视频,或在线搜索 YouTube 视频。
|
||||
- **收藏夹**:创建自定义收藏夹以整理您的视频。
|
||||
- **现代化 UI**:响应式深色主题界面,包含“返回主页”功能和玻璃拟态效果。
|
||||
@@ -103,6 +105,7 @@ npm run build # 为生产环境构建前端
|
||||
|
||||
### 视频
|
||||
- `POST /api/download` - 下载视频 (YouTube 或 Bilibili)
|
||||
- `POST /api/upload` - 上传本地视频文件
|
||||
- `GET /api/videos` - 获取所有已下载的视频
|
||||
- `GET /api/videos/:id` - 获取特定视频
|
||||
- `DELETE /api/videos/:id` - 删除视频
|
||||
|
||||
@@ -10,9 +10,11 @@ A YouTube/Bilibili video downloader and player application that allows you to do
|
||||
## Features
|
||||
|
||||
- **Video Downloading**: Download YouTube and Bilibili videos with a simple URL input.
|
||||
- **Video Upload**: Upload local video files directly to your library with automatic thumbnail generation.
|
||||
- **Bilibili Support**: Support for downloading single videos, multi-part videos, and entire collections/series.
|
||||
- **Parallel Downloads**: Queue multiple downloads and track their progress simultaneously.
|
||||
- **Local Library**: Automatically save video thumbnails and metadata for a rich browsing experience.
|
||||
- **Video Player**: Custom player with Play/Pause, Loop, and Seek controls.
|
||||
- **Search**: Search for videos locally in your library or online via YouTube.
|
||||
- **Collections**: Organize videos into custom collections for easy access.
|
||||
- **Modern UI**: Responsive, dark-themed interface with a "Back to Home" feature and glassmorphism effects.
|
||||
@@ -104,6 +106,7 @@ npm run build # Build the frontend for production
|
||||
|
||||
### Videos
|
||||
- `POST /api/download` - Download a video (YouTube or Bilibili)
|
||||
- `POST /api/upload` - Upload a local video file
|
||||
- `GET /api/videos` - Get all downloaded videos
|
||||
- `GET /api/videos/:id` - Get a specific video
|
||||
- `DELETE /api/videos/:id` - Delete a video
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { exec } from "child_process";
|
||||
import { Request, Response } from "express";
|
||||
import fs from "fs-extra";
|
||||
import multer from "multer";
|
||||
@@ -7,12 +8,12 @@ import downloadManager from "../services/downloadManager";
|
||||
import * as downloadService from "../services/downloadService";
|
||||
import * as storageService from "../services/storageService";
|
||||
import {
|
||||
extractBilibiliVideoId,
|
||||
extractUrlFromText,
|
||||
isBilibiliUrl,
|
||||
isValidUrl,
|
||||
resolveShortUrl,
|
||||
trimBilibiliUrl
|
||||
extractBilibiliVideoId,
|
||||
extractUrlFromText,
|
||||
isBilibiliUrl,
|
||||
isValidUrl,
|
||||
resolveShortUrl,
|
||||
trimBilibiliUrl
|
||||
} from "../utils/helpers";
|
||||
|
||||
// Configure Multer for file uploads
|
||||
@@ -401,7 +402,6 @@ export const getVideoComments = async (req: Request, res: Response): Promise<any
|
||||
}
|
||||
};
|
||||
|
||||
import { exec } from "child_process";
|
||||
|
||||
// Upload video
|
||||
export const uploadVideo = async (req: Request, res: Response): Promise<any> => {
|
||||
|
||||
@@ -3,7 +3,7 @@ export interface Video {
|
||||
title: string;
|
||||
author: string;
|
||||
date: string;
|
||||
source: 'youtube' | 'bilibili';
|
||||
source: 'youtube' | 'bilibili' | 'local';
|
||||
sourceUrl: string;
|
||||
videoFilename?: string;
|
||||
thumbnailFilename?: string;
|
||||
|
||||
Reference in New Issue
Block a user