Skip to content

Commit 3dbc68d

Browse files
committed
backup plan
1 parent db82101 commit 3dbc68d

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

scripts/ggdrive_downloadVideo.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export default {
1515
"https://www.facebook.com/groups/j2team.community/posts/974953859503401/",
1616

1717
changeLogs: {
18+
"2024-08-14": "get video url directly",
1819
"2024-07-25": "add backup plan",
1920
},
2021

@@ -63,13 +64,14 @@ export default {
6364
},
6465
contentScript: {
6566
onClick_: async () => {
67+
const { openPopupWithHtml } = await import("./helpers/utils.js");
68+
6669
let url = new URL(location.href);
6770
const player_response = url.searchParams.get("player_response");
6871
if (player_response) {
6972
const json = JSON.parse(player_response);
7073
console.log(document.title, json);
7174

72-
const { openPopupWithHtml } = await import("./helpers/utils.js");
7375
openPopupWithHtml(
7476
`<h1>${document.title}</h1>
7577
${json.streamingData.formats
@@ -83,6 +85,23 @@ export default {
8385
700,
8486
700
8587
);
88+
} else {
89+
const videos = document.querySelectorAll("video");
90+
if (videos.length) {
91+
openPopupWithHtml(
92+
`<h1>${document.title}</h1>
93+
${Array.from(videos)
94+
.map((_) => {
95+
return /*html*/ `<div>
96+
<h1><a href="${_.src}" target="_blank">Link</a></h1>
97+
<video src="${_.src}" controls style="max-width:95%" />
98+
</div>`;
99+
})
100+
.join("<br/>")}`,
101+
700,
102+
700
103+
);
104+
}
86105
}
87106
},
88107
},

0 commit comments

Comments
 (0)