Guest User

Untitled

a guest
Jul 16th, 2025
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.49 KB | None | 0 0
  1. javascript:(function(){
  2. var d=document,
  3. b=d.body,
  4. v=d.createElement('div'),
  5. baseUrl=location.protocol+'//'+location.hostname;
  6.  
  7. v.id='adsViewer';
  8. v.style.cssText='position:fixed;top:20px;right:20px;z-index:9999;background:white;padding:20px;border:2px solid #2196F3;border-radius:8px;width:450px;max-height:80vh;overflow-y:auto;box-shadow:0 4px 20px rgba(0,0,0,0.2);font-family:Arial,sans-serif';
  9.  
  10. v.innerHTML=[
  11. '<style>',
  12. '#adsViewer h3{margin:0 0 15px 0;color:#1976D2}',
  13. '#adsViewer .close{position:absolute;top:10px;right:10px;cursor:pointer;font-size:20px;color:#666}',
  14. '#adsViewer .close:hover{color:#000}',
  15. '#adsViewer .loading{color:#666;text-align:center}',
  16. '#adsViewer .error{color:#d32f2f;background:#ffebee;padding:10px;border-radius:4px}',
  17. '#adsViewer ul{list-style:none;padding:0;margin:0}',
  18. '#adsViewer li{background:#f5f5f5;margin:8px 0;padding:10px;border-radius:4px;font-size:13px}',
  19. '#adsViewer .pub-id{font-weight:bold;color:#333}',
  20. '#adsViewer .pub-name{color:#4CAF50;margin-left:5px}',
  21. '#adsViewer .not-found{color:#ff9800;font-style:italic}',
  22. '#adsViewer .stats{background:#e3f2fd;padding:10px;border-radius:4px;margin:10px 0}',
  23. '</style>',
  24. '<span class="close" onclick="this.parentElement.remove()">✕</span>',
  25. '<h3>📊 Google ads.txt Analysis</h3>',
  26. '<div class="loading">Loading ads.txt...</div>'
  27. ].join('');
  28.  
  29. b.appendChild(v);
  30.  
  31. function setContent(html){
  32. var loading=v.querySelector('.loading');
  33. if(loading) loading.remove();
  34. var div=d.createElement('div');
  35. div.innerHTML=html;
  36. v.appendChild(div);
  37. }
  38.  
  39. function tryProxies(url){
  40. var proxies=[
  41. 'https://corsproxy.io/?'+encodeURIComponent(url),
  42. 'https://api.codetabs.com/v1/proxy?quest='+encodeURIComponent(url),
  43. 'https://proxy.cors.sh/'+url
  44. ];
  45.  
  46. function tryNext(index){
  47. if(index>=proxies.length){
  48. return Promise.reject(new Error('All proxies failed'));
  49. }
  50.  
  51. return fetch(proxies[index])
  52. .then(function(r){
  53. if(!r.ok) throw new Error('HTTP '+r.status);
  54. return r.json();
  55. })
  56. .catch(function(){
  57. console.log('Proxy '+(index+1)+' failed, trying next...');
  58. return tryNext(index+1);
  59. });
  60. }
  61.  
  62. return tryNext(0);
  63. }
  64.  
  65. fetch(baseUrl+'/ads.txt')
  66. .then(function(r){
  67. if(!r.ok) throw new Error('ads.txt not found');
  68. return r.text();
  69. })
  70. .then(function(text){
  71. var pubIds=[];
  72. var lines=text.split('\n');
  73.  
  74. lines.forEach(function(line){
  75. var match=line.match(/google\.com,\s*(pub-\d+)/i);
  76. if(match && match[1] && pubIds.indexOf(match[1])===-1){
  77. pubIds.push(match[1]);
  78. }
  79. });
  80.  
  81. if(pubIds.length===0){
  82. setContent('<div class="error">No Google publisher IDs found in ads.txt</div>');
  83. return;
  84. }
  85.  
  86. setContent('<div class="stats">Found '+pubIds.length+' Google publisher ID(s). Fetching details...</div>');
  87.  
  88. tryProxies('https://storage.googleapis.com/adx-rtb-dictionaries/sellers.json')
  89. .then(function(data){
  90. var html='<ul>';
  91. var verified=0;
  92.  
  93. pubIds.forEach(function(pubId){
  94. var seller=null;
  95. if(data && data.sellers){
  96. seller=data.sellers.find(function(s){
  97. return s.seller_id===pubId;
  98. });
  99. }
  100.  
  101. if(seller){
  102. verified++;
  103. html+='<li><span class="pub-id">'+pubId+'</span><span class="pub-name">✓ '+seller.name+'</span></li>';
  104. }else{
  105. html+='<li><span class="pub-id">'+pubId+'</span><span class="not-found"> ⚠ Not found in Google database</span></li>';
  106. }
  107. });
  108.  
  109. html+='</ul>';
  110. html='<div class="stats">✅ Verified: '+verified+' / '+pubIds.length+'</div>'+html;
  111.  
  112. setContent(html);
  113. })
  114. .catch(function(err){
  115. console.error('Proxy error:',err);
  116. var html='<div class="stats">⚠️ Could not fetch seller names (proxy error)</div><ul>';
  117.  
  118. pubIds.forEach(function(pubId,i){
  119. html+='<li><span class="pub-id">'+pubId+'</span> <em>(ID #'+(i+1)+')</em></li>';
  120. });
  121.  
  122. html+='</ul><p style="font-size:12px;color:#666;margin-top:15px">Tip: Try again later or verify manually at storage.googleapis.com/adx-rtb-dictionaries/sellers.json</p>';
  123.  
  124. setContent(html);
  125. });
  126. })
  127. .catch(function(err){
  128. setContent('<div class="error">Error: '+err.message+'</div>');
  129. });
  130. })();
Advertisement
Add Comment
Please, Sign In to add comment