Skip to content

Commit b3e0be0

Browse files
committed
douyin - WIP
1 parent 6bf1734 commit b3e0be0

File tree

3 files changed

+62
-0
lines changed

3 files changed

+62
-0
lines changed

popup/tabs.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ const tabs = [
201201
s.tiktok_downloadVideo,
202202
s.tiktok_batchDownload,
203203
createTitle("--- Douyin ---", "--- Douyin ---"),
204+
s.douyin_batchDownload,
204205
s.douyin_downloadWachingVideo,
205206
s.douyin_downloadAllVideoUser,
206207
],

scripts/@index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,3 +171,4 @@ export { default as youtube_changeCountry } from "./youtube_changeCountry.js";
171171
export { default as fb_autoLike } from "./fb_autoLike.js";
172172
export { default as guland_VIP } from "./guland_VIP.js";
173173
export { default as pip_anything } from "./pip_anything.js";
174+
export { default as douyin_batchDownload } from "./douyin_batchDownload.js";

scripts/douyin_batchDownload.js

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import { hookFetch, hookXHR } from "./libs/ajax-hook/index.js";
2+
3+
export default {
4+
icon: "",
5+
name: {
6+
en: "Douyin - Batch download",
7+
vi: "Douyin - Tải hàng loạt",
8+
},
9+
description: {
10+
en: "",
11+
vi: "",
12+
img: "",
13+
},
14+
15+
infoLink: "",
16+
17+
changeLogs: {
18+
date: "description",
19+
},
20+
21+
whiteList: ["https://www.douyin.com/*"],
22+
23+
pageScript: {
24+
onDocumentStart: (details) => {
25+
const CACHED = {
26+
list: [],
27+
byAwemeId: new Map(),
28+
};
29+
30+
window.ufs_douyin_batchDownload = CACHED;
31+
32+
hookXHR({
33+
onAfterSend: async (
34+
{ method, url, async, user, password },
35+
dataSend,
36+
response
37+
) => {
38+
console.log(method, url, dataSend, response);
39+
40+
if (url.includes("aweme/") && url.includes("/post")) {
41+
const res = response.clone();
42+
const json = await res.json();
43+
console.log(json);
44+
45+
if (json?.aweme_list?.length) {
46+
CACHED.list.push(...json.aweme_list);
47+
json.aweme_list.forEach((item) => {
48+
if (!CACHED.byAwemeId.has(item.aweme_id)) {
49+
CACHED.byAwemeId.set(item.aweme_id, item);
50+
}
51+
});
52+
}
53+
}
54+
},
55+
});
56+
},
57+
58+
onClick: () => {},
59+
},
60+
};

0 commit comments

Comments
 (0)