-
Notifications
You must be signed in to change notification settings - Fork 0
/
select_links.js
58 lines (37 loc) · 1.18 KB
/
select_links.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
let links = document.querySelectorAll('.pcVideoListItem.js-pop.videoblock.videoBox.canEdit .usernameWrap a');
let arrayoflinks = [];
for(var i = 0; i< links.length; i++){
arrayoflinks.push(links[i].href)
}
console.log(arrayoflinks);
*/
function sleep(milliseconds) {
let start = new Date().getTime();
for (let i = 0; i < 1e7; i++) {
if ((new Date().getTime() - start) > milliseconds){
break;
}
}
}
let links = document.querySelectorAll(".index-container a");
for (let i = 0; i < links.length; i++) {
window.open(links[i], '_blank');
sleep(100);
}
/* проще
let elements = document.querySelectorAll(`.video-thumb-info a`);
let output = Array.from(elements).map(i=>{return i.href}).join("<br>");
window.open().document.write(output);
*/
function urlSiteCrop(url) {
let output = url.replace(/^/, `"`).replace(/$/, `",`);
return output;
};
let elements = document.querySelectorAll(`.video-thumb-info a`);
let output = Array.from(elements).map(i => { return i.href });
let govno = [];
for (let i = 0; i < output.length; i++) {
govno[i] = urlSiteCrop(output[i]) + "" + ("<br>");
}
window.open().document.write(govno.join(""));