- finished writing tests for all services
- fixed douyin support
- fixed tiktok picker that was broken by previous commit
- temporarily removed douyin photos from list of supported services
- fixed support for "user view" vk clip links
- slightly improved the testing script
This commit is contained in:
wukko
2023-02-13 19:44:58 +06:00
parent 0e7a281366
commit 75a85972aa
10 changed files with 784 additions and 296 deletions

View File

@ -12,11 +12,11 @@ export default function(r, host, ip, audioFormat, isAudioOnly, lang, isAudioMute
filename: r.filename,
},
params = {}
if (isAudioMuted) action = "muteVideo";
if (!isAudioOnly && !r.picker && !isAudioMuted) action = "video";
if (isAudioOnly && !r.picker) action = "audio";
if (r.picker) action = "picker";
if (isAudioOnly) action = "audio";
if (isAudioMuted) action = "muteVideo";
if (action === "picker" || action === "audio") {
defaultParams.filename = r.audioFilename;

View File

@ -1,6 +1,6 @@
import { genericUserAgent, maxVideoDuration } from "../../config.js";
// TO-DO: quality picking & bilibili.tv support
// TO-DO: quality picking, bilibili.tv support, and higher quality downloads (currently requires an account)
export default async function(obj) {
let html = await fetch(`https://bilibili.com/video/${obj.id}`, {
headers: { "user-agent": genericUserAgent }

View File

@ -8,7 +8,7 @@ let userAgent = genericUserAgent.split(' Chrome/1')[0],
},
douyin: {
short: "https://v.douyin.com/",
api: "https://www.iesdouyin.com/web/api/v2/aweme/iteminfo/?item_ids={postId}",
api: "https://www.iesdouyin.com/aweme/v1/web/aweme/detail/?aweme_id={postId}",
}
}
@ -17,14 +17,14 @@ function selector(j, h, id) {
let t;
switch (h) {
case "tiktok":
t = j["aweme_list"].filter((v) => { if (v["aweme_id"] === id) return true });
t = j["aweme_list"].filter((v) => { if (v["aweme_id"] === id) return true })[0];
break;
case "douyin":
t = j['item_list'].filter((v) => { if (v["aweme_id"] === id) return true });
t = j['aweme_detail'];
break;
}
if (!t.length > 0) return false;
return t[0];
if (t.length < 3) return false;
return t;
}
export default async function(obj) {
@ -34,7 +34,7 @@ export default async function(obj) {
headers: { "user-agent": userAgent }
}).then((r) => { return r.text() }).catch(() => { return false });
if (!html) return { error: 'ErrorCouldntFetch' };
if (html.slice(0, 17) === '<a href="https://' && html.includes('/video/')) {
obj.postId = html.split('/video/')[1].split('?')[0].replace("/", '')
} else if (html.slice(0, 32) === '<a href="https://m.tiktok.com/v/' && html.includes('/v/')) {
@ -59,10 +59,10 @@ export default async function(obj) {
}
if (!obj.isAudioOnly && !images) {
video = obj.host === "tiktok" ? detail["video"]["download_addr"]["url_list"][0] : detail['video']['play_addr']['url_list'][0];
video = obj.host === "tiktok" ? detail["video"]["download_addr"]["url_list"][0] : detail["video"]["play_addr"]["url_list"][2].replace("/play/", "/playwm/");
videoFilename = `${filenameBase}_video.mp4`;
if (obj.noWatermark) {
video = obj.host === "tiktok" ? detail["video"]["play_addr"]["url_list"][0] : detail["video"]["play_addr"]["url_list"][0].replace("playwm", "play");
video = obj.host === "tiktok" ? detail["video"]["play_addr"]["url_list"][0] : detail["video"]["play_addr"]["url_list"][0];
videoFilename = `${filenameBase}_video_nw.mp4` // nw - no watermark
}
} else {
@ -80,13 +80,11 @@ export default async function(obj) {
urls: video,
filename: videoFilename
}
if (images && obj.isAudioOnly) {
return {
urls: audio,
audioFilename: audioFilename,
isAudioOnly: true,
isMp3: isMp3,
}
if (images && obj.isAudioOnly) return {
urls: audio,
audioFilename: audioFilename,
isAudioOnly: true,
isMp3: isMp3
}
if (images) {
let imageLinks = [];
@ -100,13 +98,13 @@ export default async function(obj) {
urls: audio,
audioFilename: audioFilename,
isAudioOnly: true,
isMp3: isMp3,
isMp3: isMp3
}
}
if (audio) return {
urls: audio,
audioFilename: audioFilename,
isAudioOnly: true,
isMp3: isMp3,
isMp3: isMp3
}
}

View File

@ -13,13 +13,13 @@
"enabled": true
},
"twitter": {
"alias": "twitter posts & spaces",
"alias": "twitter posts & spaces & voice",
"patterns": [":user/status/:id", ":user/status/:id/video/:v", "i/spaces/:spaceId"],
"enabled": true
},
"vk": {
"alias": "vk video & clips",
"patterns": ["video-:userId_:videoId", "clip-:userId_:videoId", "clips-:userId?z=clip-:userId_:videoId"],
"patterns": ["video-:userId_:videoId", "clip-:userId_:videoId", "clips-:duplicate?z=clip-:userId_:videoId"],
"quality_match": {
"2160": 7,
"1440": 6,
@ -70,7 +70,7 @@
"enabled": true
},
"douyin": {
"alias": "douyin videos & photos & audio",
"alias": "douyin videos & audio",
"patterns": ["video/:postId", ":id"],
"enabled": true
},