Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] refactor(provider): remove yt-download source #1209

Merged
merged 1 commit into from
Aug 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ node app.js -o bilibili ytdlp
| 咪咕音乐 | `migu` | ✅ | 需要准备自己的 `MIGU_COOKIE`(请参阅下方〈环境变量〉处)。 |
| JOOX | `joox` | | 需要准备自己的 `JOOX_COOKIE`(请参阅下方〈环境变量〉处)。似乎有严格地区限制。 |
| YouTube(纯 JS 解析方式) | `youtube` | | 需要 Google 认定的**非中国大陆区域** IP 地址。 |
| yt-download | `ytdownload` | | **似乎不能使用**。 |
| YouTube(通过 `youtube-dl`) | `youtubedl` | | 需要自行安装 `youtube-dl`。 |
| YouTube(通过 `yt-dlp`) | `ytdlp` | ✅ | 需要自行安装 `yt-dlp`(`youtube-dl` 仍在活跃维护的 fork)。 |
| B 站音乐 | `bilibili` | ✅ | |
Expand Down
1 change: 0 additions & 1 deletion src/consts.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const PROVIDERS = {
migu: require('./provider/migu'),
joox: require('./provider/joox'),
youtube: require('./provider/youtube'),
ytdownload: require('./provider/yt-download'),
youtubedl: require('./provider/youtube-dl'),
ytdlp: require('./provider/yt-dlp'),
bilibili: require('./provider/bilibili'),
Expand Down
10 changes: 2 additions & 8 deletions src/provider/match.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ const logger = logScope('provider/match');
const isHttpResponseOk = (code) => code >= 200 && code <= 299;

/** @type {Map<string, string>} */
const headerReferer = new Map([
['bilivideo.com', 'https://www.bilibili.com/'],
['yt-download.org', 'https://www.yt-download.org/'],
]);
const headerReferer = new Map([['bilivideo.com', 'https://www.bilibili.com/']]);

/**
* @typedef {{ size: number, br: number | null, url: string | null, md5: string | null }} AudioData
Expand Down Expand Up @@ -215,10 +212,7 @@ async function check(url) {
) || 0;

// Check if the Content-Length equals 8192.
if (
!isHost('yt-download.org') &&
headers['content-length'] !== '8192'
) {
if (headers['content-length'] !== '8192') {
// I'm not sure how to describe this.
// Seems like not important.
return Promise.reject();
Expand Down
63 changes: 0 additions & 63 deletions src/provider/yt-download.js

This file was deleted.

3 changes: 0 additions & 3 deletions src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,6 @@ const proxy = {
req.headers['referer'] = 'https://www.bilibili.com/';
req.headers['user-agent'] = 'okhttp/3.4.1';
}
if (isHost(req.url, 'yt-download.org')) {
req.headers['referer'] = 'https://www.yt-download.org/';
}
const url = parse(req.url);
const options = request.configure(req.method, url, req.headers);
ctx.proxyReq = request
Expand Down