-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScriptex.js
More file actions
35 lines (33 loc) · 1021 Bytes
/
Copy pathScriptex.js
File metadata and controls
35 lines (33 loc) · 1021 Bytes
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
var saveData = (function () {
var a = document.createElement("a");
document.body.appendChild(a);
a.style = "display: none";
return function (data, fileName) {
var json = JSON.stringify(data);
blob = new Blob([json], {type: "octet/stream"});
console.log(json);
url = window.URL.createObjectURL(blob);
a.href = url;
a.download = fileName;
a.click();
window.URL.revokeObjectURL(url);
};
}());
async function run() {
ob={
videos:[],
photos:[],
a:[]
}; document.querySelectorAll("video").forEach(function (e,i) {
ob.videos.push({vid:e.src,thumb:e.poster});
});
document.querySelectorAll("img").forEach(function (e,i) {
ob.photos.push({vid:e.src,thumb:e.poster});
});
document.querySelectorAll("a").forEach(function (e,i) {
ob.a.push({text:e.textContent,url:e.href});
});
title=document.querySelector("title").textContent;
console.log(title);
xx=await saveData(ob,title+".json");
}