forked from lovmoon3k/useful-script
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfb_getAllVideoId.js
33 lines (32 loc) · 919 Bytes
/
fb_getAllVideoId.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
export default {
name: {
en: "Get all fb Video ID",
vi: "Tìm tất cả fb video id",
},
description: {
en: "Get id of all video in current website",
vi: "Tìm tất cả video id trong trang web",
},
blackList: [],
whiteList: ["*://www.facebook.com"],
func: function () {
const list_a = document.querySelectorAll("a");
const list_id = [];
for (let a of Array.from(list_a)) {
const check = /(?<=\/videos\/)(.\d+?)($|(?=\/))/.exec(a.href);
if (check && check[0]) {
list_id.push(check[0]);
}
}
if (list_id.length)
window.prompt(
`Tìm thấy ${list_id.length} video id: `,
list_id.join(", ")
);
else
window.prompt(
"Không tìm thấy video id nào trong trang web!\nBạn có ở đúng trang video chưa?\nTrang web ví dụ:",
"https://www.facebook.com/watch/?ref=tab"
);
},
};