Skip to content

Commit 5ffae39

Browse files
committed
douyin downloader
1 parent 7072636 commit 5ffae39

File tree

4 files changed

+49
-3
lines changed

4 files changed

+49
-3
lines changed

popup/tabs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ const tabs = [
135135
},
136136
{
137137
...CATEGORY.tiktok,
138-
scripts: [s.tiktok_downloadVideo],
138+
scripts: [s.tiktok_downloadVideo, s.douyin_downloadVideo],
139139
},
140140
{
141141
...CATEGORY.github,

scripts/douyin_downloadVideo.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
export default {
2+
icon: "https://www.douyin.com/favicon.ico",
3+
name: {
4+
en: "Douyin - Download videos",
5+
vi: "Douyin - Tải videos",
6+
},
7+
description: {
8+
en: "Show all downloadable videos in current douyin webpage",
9+
vi: "Hiển thị mọi video có thể tải trong trang douyin hiện tại",
10+
},
11+
blackList: [],
12+
whiteList: ["https://www.douyin.com/*"],
13+
14+
func: function () {
15+
let videos = Array.from(document.querySelectorAll("video"));
16+
17+
if (!videos.length) {
18+
alert("Không tìm thấy video nào.");
19+
return;
20+
}
21+
22+
let html = `
23+
<div style="display:flex;align-items:center;justify-content:center;position:fixed;top:0;left:0;right:0;bottom:0;background:#000e;z-index:9999999">
24+
<div style="margin:auto;background:#eee;position:relative;padding:20px;overflow:auto;max-height:90vh;">
25+
${videos
26+
.map((video) => {
27+
return (
28+
`<video controls style="max-width:50vw">` +
29+
video.innerHTML +
30+
`</video>`
31+
);
32+
})
33+
.join("<br/>")}
34+
<button
35+
onclick="this.parentElement.parentElement.remove()"
36+
style="position:absolute;top:0;right:0;background:red;cursor:pointer;padding:5px 10px;color:white">Close</button>
37+
</div>
38+
</div>`;
39+
40+
let div = document.createElement("div");
41+
div.innerHTML = html;
42+
document.body.appendChild(div);
43+
},
44+
};

scripts/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ import visualEvent from "./visualEvent.js";
112112
import fb_videoDownloader from "./fb_videoDownloader.js";
113113
import viewBrowserInfo from "./viewBrowserInfo.js";
114114
import tiktok_downloadVideo from "./tiktok_downloadVideo.js";
115+
import douyin_downloadVideo from "./douyin_downloadVideo.js";
115116

116117
// inject badges
117118
const allScripts = {
@@ -233,6 +234,7 @@ const allScripts = {
233234
fb_videoDownloader: addBadge(fb_videoDownloader, BADGES.new),
234235
viewBrowserInfo: addBadge(viewBrowserInfo, BADGES.new),
235236
tiktok_downloadVideo: addBadge(tiktok_downloadVideo, BADGES.new),
237+
douyin_downloadVideo: addBadge(douyin_downloadVideo, BADGES.new),
236238
};
237239

238240
// inject id to all scripts

scripts/tiktok_downloadVideo.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import {
88
export default {
99
icon: "https://www.tiktok.com/favicon.ico",
1010
name: {
11-
en: "Download tiktok video (Snaptik)",
12-
vi: "Tải video tiktok (Snaptik)",
11+
en: "Tiktok - Download video (Snaptik)",
12+
vi: "Tiktok - Tải video (Snaptik)",
1313
},
1414
description: {
1515
en: "Download tiktok video using Snaptik API",

0 commit comments

Comments
 (0)