Skip to content

Commit

Permalink
refactor(provider): remove yt-download source
Browse files Browse the repository at this point in the history
This API does no longer provide direct download link, remove it.

Signed-off-by: Tianling Shen <[email protected]>
  • Loading branch information
1715173329 committed Aug 19, 2023
1 parent 10d0898 commit 5a37085
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 75 deletions.
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

0 comments on commit 5a37085

Please sign in to comment.