Skip to content

Commit da936b9

Browse files
committed
down document
1 parent e797050 commit da936b9

File tree

8 files changed

+110
-46
lines changed

8 files changed

+110
-46
lines changed

popup/helpers/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export async function viewScriptSource(script) {
2525
}
2626

2727
export async function updateScriptClickCount(scriptId) {
28-
// return; // TODO remove this before commit
28+
return; // TODO remove this before commit
2929
try {
3030
let res = await fetch(
3131
"https://useful-script-statistic.onrender.com/count",

popup/tabs.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ const tabs = [
6767
s.showTheImages,
6868
s.download_image,
6969
createTitle("--- Document ---", "--- Tài liệu ---"),
70+
s.docDownloader,
7071
s.scribd_downloadDocuments,
7172
s.studocu_dl,
7273
s.studocu_downs,
@@ -227,6 +228,7 @@ const tabs = [
227228
createTitle("--- Unlock web ---", "--- Mở khoá web ---"),
228229
s.donotBlockMe,
229230
s.envato_bypassPreview,
231+
s.scribd_bypassPreview,
230232
s.studyphim_unlimited,
231233
s.studocu_bypassPreview,
232234
createTitle("--- Unlock function ---", "--- Mở khoá chức năng ---"),

scripts/docDownloader.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { getCurrentTab } from "./helpers/utils.js";
2+
3+
export default {
4+
icon: "https://docdownloader.com/public/img/apple-icon-180x180.png",
5+
name: {
6+
en: "DocDownloader - Download document",
7+
vi: "DocDownloader - Tải document",
8+
},
9+
description: {
10+
en: "Download document on Scribd ,Issuu ,Slideshare ,Academia",
11+
vi: "Tải document từ Scribd ,Issuu ,Slideshare ,Academia",
12+
},
13+
onClickExtension: async () => {
14+
let tab = await getCurrentTab();
15+
let url = prompt("Nhập document URL:", tab.url);
16+
if (url == null) return;
17+
18+
window.open("https://docdownloader.com/?url=" + url);
19+
},
20+
};

scripts/fb_exportSaved.js

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -20,79 +20,79 @@ export default {
2020
: e;
2121
});
2222

23-
const checkExit = (e) => {
23+
const c = (e) => {
2424
try {
2525
return e();
2626
} catch (e) {
2727
return !1;
2828
}
2929
};
3030

31-
const get_posts = async (uid, fb_dtsg, cursor) => {
32-
console.log("Đang lấy dữ liệu! Vui lòng chờ trong giây lát...");
31+
const getSaved = async (uid, fb_dtsg, cursor = "") => {
3332
if (cursor) cursor = `"cursor":"${cursor}",`;
34-
35-
uid = encodeURIComponent(uid);
36-
fb_dtsg = encodeURIComponent(fb_dtsg);
3733
cursor = encodeURIComponent(
3834
`{"content_filter":null,"count":10,${cursor}"scale":1}`
3935
);
40-
4136
const res = await fetch("https://www.facebook.com/api/graphql/", {
4237
body: `av: 100000034778747&__user=${uid}&__dyn=&fb_dtsg=${fb_dtsg}&fb_api_req_friendly_name=CometSaveDashboardAllItemsPaginationQuery&variables=${cursor}&server_timestamps=true&doc_id=3196659713724388`,
4338
method: "POST",
4439
mode: "cors",
4540
credentials: "include",
4641
headers: { "Content-Type": "application/x-www-form-urlencoded" },
4742
});
48-
let json = await res.json();
49-
console.log(json);
50-
json.data.viewer.saver_info.all_saves.edges.forEach((e) => {
51-
data.push({
52-
title: encodeHTML(checkExit(() => e.node.savable.savable_title.text)),
53-
type: checkExit(() => e.node.savable.__typename),
54-
image: checkExit(() => e.node.savable.savable_image.uri),
55-
url: checkExit(() => e.node.savable.url),
56-
urlPost: checkExit(() => e.node.container_savable.savable_permalink),
57-
sourceType: checkExit(
58-
() => e.node.container_savable.savable_actors[0].__typename
59-
),
60-
sourceName: checkExit(
61-
() => e.node.container_savable.savable_actors[0].name
62-
),
63-
sourceID: checkExit(
64-
() => e.node.container_savable.savable_actors[0].id
65-
),
66-
sourceImage: checkExit(
67-
() => e.node.container_savable.savable_actors[0].profile_picture.uri
68-
),
43+
return await res.json();
44+
};
45+
46+
const getAllSaved = async (uid, fb_dtsg, cursor) => {
47+
uid = encodeURIComponent(uid);
48+
fb_dtsg = encodeURIComponent(fb_dtsg);
49+
50+
let data = [];
51+
let page = 1;
52+
while (true) {
53+
setLoadingText("Đang tải trang " + page + "...");
54+
let json = await getSaved(uid, fb_dtsg, cursor);
55+
console.log(json);
56+
json.data.viewer.saver_info.all_saves.edges.forEach((e) => {
57+
data.push({
58+
title: encodeHTML(c(() => e.node.savable.savable_title.text)),
59+
type: c(() => e.node.savable.__typename),
60+
image: c(() => e.node.savable.savable_image.uri),
61+
url: c(() => e.node.savable.url),
62+
urlPost: c(() => e.node.container_savable.savable_permalink),
63+
sourceType: c(
64+
() => e.node.container_savable.savable_actors[0].__typename
65+
),
66+
sourceName: c(
67+
() => e.node.container_savable.savable_actors[0].name
68+
),
69+
sourceID: c(() => e.node.container_savable.savable_actors[0].id),
70+
sourceImage: c(
71+
() =>
72+
e.node.container_savable.savable_actors[0].profile_picture.uri
73+
),
74+
});
6975
});
70-
});
71-
let s = !1;
72-
if (
73-
(checkExit(
74-
() => json.data.viewer.saver_info.all_saves.page_info.has_next_page
75-
) &&
76-
(s = json.data.viewer.saver_info.all_saves.page_info.has_next_page),
77-
!0 === s)
78-
)
79-
await get_posts(
80-
json.data.viewer.saver_info.all_saves.page_info.end_cursor
76+
let nextCursor = c(
77+
() => json.data.viewer.saver_info.all_saves.page_info.end_cursor
8178
);
82-
else {
83-
// let e = window.btoa(unescape(encodeURIComponent(JSON.stringify(data))));
84-
// template(e);
85-
console.log("Done! Đang xuất dữ liệu...");
79+
if (nextCursor) cursor = nextCursor;
80+
else break;
81+
page++;
8682
}
83+
return data;
8784
};
8885

8986
let { setLoadingText, closeLoading } = showLoading("Đang lấy token...");
9087
try {
88+
setLoadingText("Đang chuẩn bị...");
9189
let [fb_dtsg, uid] = await runScriptInCurrentTab(() => [
9290
require("DTSGInitialData").token,
9391
require("CurrentUserInitialData").USER_ID,
9492
]);
95-
get_posts(uid, fb_dtsg);
93+
setLoadingText("Đang lấy dữ liệu...");
94+
let saved = await getAllSaved(uid, fb_dtsg);
95+
console.log(saved);
9696
} catch (e) {
9797
alert("ERROR: " + e);
9898
} finally {

scripts/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ import fb_whoIsTyping from "./fb_whoIsTyping.js";
161161
import detect_zeroWidthCharacters from "./detect_zeroWidthCharacters.js";
162162
import fb_moreReactionStory from "./fb_moreReactionStory.js";
163163
import changeAudioOutput from "./changeAudioOutput.js";
164+
import docDownloader from "./docDownloader.js";
165+
import scribd_bypassPreview from "./scribd_bypassPreview.js";
164166

165167
// inject badges
166168
const allScripts = {
@@ -343,6 +345,8 @@ const allScripts = {
343345
detect_zeroWidthCharacters: addBadge(detect_zeroWidthCharacters, BADGES.new),
344346
fb_moreReactionStory: addBadge(fb_moreReactionStory, BADGES.new),
345347
changeAudioOutput: addBadge(changeAudioOutput, BADGES.new),
348+
docDownloader: addBadge(docDownloader, BADGES.new),
349+
scribd_bypassPreview: addBadge(scribd_bypassPreview, BADGES.new),
346350
};
347351

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

scripts/scribd_bypassPreview.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.auto__doc_page_webpack_doc_page_blur_promo {
2+
display: none !important;
3+
}

scripts/scribd_bypassPreview.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
export default {
2+
icon: "https://www.scribd.com/favicon.ico",
3+
name: {
4+
en: "Scribd - bypass preview",
5+
vi: "Scribd - Xem miễn phí VIP",
6+
},
7+
description: {
8+
en: "View VIP document on Scribd.com, bypass preview popup / reveal blurred content.",
9+
vi: "Xem tài liệu VIP trên Scribd.com, loại bỏ popup chặn xem trước, loại bỏ hiệu ứng làm mờ.",
10+
},
11+
blackList: [],
12+
whiteList: ["https://www.scribd.com/*"],
13+
14+
onDocumentIdle: () => {
15+
UsefulScriptGlobalPageContext.Extension.getURL(
16+
"scripts/scribd_bypassPreview.css"
17+
).then(UsefulScriptGlobalPageContext.DOM.injectCssFile);
18+
19+
function ufs_bypass_preview() {
20+
[...document.querySelectorAll(".blurred_page .newpage *")].forEach(
21+
(el) => {
22+
if (el.style.color === "transparent") {
23+
el.style.color = "black";
24+
}
25+
}
26+
);
27+
[...document.querySelectorAll(".blurred_page")].forEach((el) => {
28+
el.classList.remove("blurred_page");
29+
});
30+
}
31+
32+
ufs_bypass_preview();
33+
setInterval(ufs_bypass_preview, 3000);
34+
},
35+
};

scripts/tiktok_snaptikApp.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
} from "./helpers/utils.js";
77

88
export default {
9-
icon: "https://snaptik.app/pwa/img/icon_x192.png",
9+
icon: "https://snaptik.app/favicon.ico",
1010
name: {
1111
en: "Tiktok - Download video (Snaptik)",
1212
vi: "Tiktok - Tải video (Snaptik)",

0 commit comments

Comments
 (0)