Skip to content

Commit 3e17e12

Browse files
committed
saveallvideo api
1 parent 9b60b3b commit 3e17e12

File tree

3 files changed

+52
-2
lines changed

3 files changed

+52
-2
lines changed

popup/tabs.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,10 @@ const tabs = [
6262
{
6363
...CATEGORY.download,
6464
scripts: [
65+
s.saveAllVideo,
66+
s.getFavicon,
6567
s.download_watchingVideo,
6668
s.getLinkLuanxt,
67-
s.getFavicon,
6869
// s.bookmark_exporter,
6970
createTitle("--- Music ---", "--- Nhạc ---"),
7071
s.showTheAudios,
@@ -162,7 +163,7 @@ const tabs = [
162163
{
163164
...CATEGORY.instagram,
164165
scripts: [
165-
s.insta_getToken,
166+
// s.insta_getToken,
166167
s.insta_getUserInfo,
167168
createTitle("--- Download ---", "--- Tải xuống ---"),
168169
s.insta_injectDownloadBtn,
@@ -176,6 +177,7 @@ const tabs = [
176177
{
177178
...CATEGORY.youtube,
178179
scripts: [
180+
s.saveAllVideo,
179181
s.youtube_downloadVideo,
180182
s.pictureInPicture,
181183
s.youtube_toggleLight,
@@ -194,6 +196,7 @@ const tabs = [
194196
s.douyin_downloadWachingVideo,
195197
s.douyin_downloadAllVideoUser,
196198
// s.douyin_batchDownload,
199+
s.saveAllVideo,
197200
createTitle("--- Doutu.be ---", "--- Doutu.be ---"),
198201
s.doutube_downloadWatchingVideo,
199202
s.doutube_getAllVideoInUserProfile,

scripts/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ import medium_readFullArticle from "./medium_readFullArticle.js";
177177
import viewSavedWifiPass from "./viewSavedWifiPass.js";
178178
import leakCheck from "./leakCheck.js";
179179
import whellOfNames_hack from "./whellOfNames_hack.js";
180+
import saveAllVideo from "./saveAllVideo.js";
180181

181182
// inject badges
182183
const allScripts = {
@@ -375,6 +376,7 @@ const allScripts = {
375376
viewSavedWifiPass: addBadge(viewSavedWifiPass, BADGES.new),
376377
leakCheck: addBadge(leakCheck, BADGES.new),
377378
whellOfNames_hack: addBadge(whellOfNames_hack, BADGES.new),
379+
saveAllVideo: addBadge(saveAllVideo, BADGES.new),
378380
};
379381

380382
// alert(Object.keys(allScripts).length);

scripts/saveAllVideo.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import { getCurrentTab, showLoading } from "./helpers/utils.js";
2+
3+
export default {
4+
icon: "https://saveallvideo.net/assets/img/favicon.png",
5+
name: {
6+
en: "Save All Video",
7+
vi: "Save All Video",
8+
},
9+
description: {
10+
en: "Download video from Douyin Twitter Instagram TikTok Youtube",
11+
vi: "Tải video từ Douyin Twitter Instagram TikTok Youtube",
12+
},
13+
infoLink:
14+
"https://www.facebook.com/groups/j2team.community/posts/2316412945357479/",
15+
16+
onClickExtension: async () => {
17+
const { closeLoading, setLoadingText } = showLoading(
18+
"Đang lấy thông tin tab..."
19+
);
20+
try {
21+
let tab = await getCurrentTab();
22+
setLoadingText("Vui lòng nhập link video muốn tải...");
23+
let url = prompt(
24+
"Nhập link video (Douyin Twitter Instagram TikTok Youtube): ",
25+
tab.url
26+
);
27+
if (url == null) return;
28+
29+
setLoadingText("Đang tải thông tin từ saveallvideo...");
30+
let res = await fetch(
31+
"https://saveallvideo.net/apiget?apiuser=j2team&apipass=j2team&url=" +
32+
url
33+
);
34+
setLoadingText("Đang xử lý thông tin...");
35+
let json = await res.json();
36+
let download_url = json?.url;
37+
if (download_url) window.open(download_url);
38+
else throw Error("API không trả link video.");
39+
} catch (e) {
40+
alert("ERROR: " + e);
41+
} finally {
42+
closeLoading();
43+
}
44+
},
45+
};

0 commit comments

Comments
 (0)