forked from develon2015/Youtube-dl-REST
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.js
More file actions
23 lines (21 loc) · 641 Bytes
/
Copy pathutils.js
File metadata and controls
23 lines (21 loc) · 641 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function getRemoteIP(request) {
return request.header('cf-connecting-ip') || request.ip || '未知IP';
}
function getWebsiteUrl(website, id, p) {
switch (website) {
case 'y2b':
return `https://youtu.be/${id}`;
case 'bilibili':
return `https://www.bilibili.com/video/${id}${p ? `?p=${p}` : ''}`;
case 'xcom':
if (p)
return `https://x.com/i/status/${id}/video/${p ? p : 1}`;
return `https://x.com/i/status/${id}`;
default:
return website;
}
}
module.exports = {
getRemoteIP,
getWebsiteUrl,
}