Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var s=document.createElement("script");s.async=false;s.defer="defer";s.src="https://unpkg.com/localforage";document.head.appendChild(s);s.onload=function(){setTimeout(update1,300)}
- async function update1(){
- //window.store= localforage.createInstance({name:"sw", storeName:"GlobalRank"});
- window.store= localforage.createInstance({name:"lru1"});
- window.store1= localforage.createInstance({name:"sw", storeName:"list"});
- var i=0;
- console.log(await store.getItem('cisco.com'));
- var vv=await store.keys();vv=vv.sort((a, b) => 0.5 - Math.random());
- for (let v of vv) {
- let o=await store.getItem(v);
- if (!o.EstimatedMonthlyVisits["2021-12-01"]) {
- console.log(i++,o.SiteName);
- let r=await fetch("https://data.similarweb.com/api/v1/data/?domain="+o.SiteName,{credentials: 'include'});
- if (r.status==200) {
- let d = await r.json();
- d.EstimatedMonthlyVisits= Object.assign( o.EstimatedMonthlyVisits,d.EstimatedMonthlyVisits);
- d.lastModified=new Date().valueOf();
- await store.setItem(d.SiteName,d);
- document.title=d.SiteName+" [ " +d.GlobalRank.Rank + " ] "+i+""
- document.body.innerHTML="<pre>"+JSON.stringify(d,null,2)+"</pre>";
- }
- if (r.status==403) {location.assign("https://data.similarweb.com/api/v1/data/?domain="+v); break;}
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement