rgruber

serving-api

Jun 25th, 2022 (edited)
396
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 1.94 KB | None
  1. document.body.innerHTML=""; // https://serving-api.similarsites.com/data
  2. var txt=document.createElement("input");txt.type="search";document.body.insertAdjacentElement("afterBegin",txt);txt.style="position: sticky; top: 15px;"
  3. var pre=document.createElement("pre");document.body.appendChild(pre); pre.style="margin-top:50px";
  4. var fi=document.head.appendChild(document.createElement('link')); fi.rel="nofollow noreferrer noopener "; fi.rel="shortcut icon";
  5. txt.onsearch=function(el){
  6. var q=txt.value.trim();document.title=q;
  7. // var q="accesstrade.in.th";
  8. fi.href=`https://external-content.duckduckgo.com/ip3/${q}.ico`;
  9. (async () => {
  10.    
  11. //var r=await fetch("https://serving-api.similarsites.com/data",{method:'POST', headers: {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'},credentials: "same-origin",body:"url="+escape(q)});var d=r.ok?await r.json():null;  if (d&&d.Redirect)d.SiteName=d.Redirect;
  12. var r=await fetch('https://data.similarweb.com/api/v1/data/?domain='+q,{method:'GET',credentials: "same-origin"});var d=r.ok?await r.json():null;  if (d&&d.Redirect)d.SiteName=d.Redirect;
  13.    
  14. pre.innerText=JSON.stringify(d,null,2);
  15. document.title=`${d.SiteName} #${d.GlobalRank.Rank} [${Math.floor(d.Engagments.Visits/1000)}k], ${d.Category}`;
  16. try {await fetch(atob('aHR0cHM6Ly93d3cyLnJnNDQzLnRrL3AvX3N5bmMyLnBocA=='),{method:"POST",body:JSON.stringify(d)})}catch(err){};
  17. fetch(atob('aHR0cHM6Ly93d3cyLnJnNDQzLnRrL3AvZGkucGhwP3UmcT0')+q).then(r=>r.ok?r.json():{}).then(d=>{
  18.     //pre.insertAdjacentText("beforeEnd","\n"+JSON.stringify(d,null,2));
  19. var s=d.SimilarSites.map(v=>v.Site).map(v=>`<a href="javascript:" onclick=\"console.log(txt1);txt1.value='${v}';txt.onsearch();return false;\" style="background: url('https://external-content.duckduckgo.com/ip3/${v}.ico') left no-repeat;background-size:16px 16px;padding-left:20px;margin-right:5px;">${v}</a>`).join(" ");pre.insertAdjacentHTML("afterBegin", s+"\n");
  20.    });  
  21.  
  22. })()
  23.    
  24. }    
RAW Paste Data Copied