Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- javascript:(function(){
- var d=document,
- b=d.body,
- v=d.createElement('div'),
- baseUrl=location.protocol+'//'+location.hostname;
- v.id='adsViewer';
- 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';
- v.innerHTML=[
- '<style>',
- '#adsViewer h3{margin:0 0 15px 0;color:#1976D2}',
- '#adsViewer .close{position:absolute;top:10px;right:10px;cursor:pointer;font-size:20px;color:#666}',
- '#adsViewer .close:hover{color:#000}',
- '#adsViewer .loading{color:#666;text-align:center}',
- '#adsViewer .error{color:#d32f2f;background:#ffebee;padding:10px;border-radius:4px}',
- '#adsViewer ul{list-style:none;padding:0;margin:0}',
- '#adsViewer li{background:#f5f5f5;margin:8px 0;padding:10px;border-radius:4px;font-size:13px}',
- '#adsViewer .pub-id{font-weight:bold;color:#333}',
- '#adsViewer .pub-name{color:#4CAF50;margin-left:5px}',
- '#adsViewer .not-found{color:#ff9800;font-style:italic}',
- '#adsViewer .stats{background:#e3f2fd;padding:10px;border-radius:4px;margin:10px 0}',
- '</style>',
- '<span class="close" onclick="this.parentElement.remove()">✕</span>',
- '<h3>📊 Google ads.txt Analysis</h3>',
- '<div class="loading">Loading ads.txt...</div>'
- ].join('');
- b.appendChild(v);
- function setContent(html){
- var loading=v.querySelector('.loading');
- if(loading) loading.remove();
- var div=d.createElement('div');
- div.innerHTML=html;
- v.appendChild(div);
- }
- function tryProxies(url){
- var proxies=[
- 'https://corsproxy.io/?'+encodeURIComponent(url),
- 'https://api.codetabs.com/v1/proxy?quest='+encodeURIComponent(url),
- 'https://proxy.cors.sh/'+url
- ];
- function tryNext(index){
- if(index>=proxies.length){
- return Promise.reject(new Error('All proxies failed'));
- }
- return fetch(proxies[index])
- .then(function(r){
- if(!r.ok) throw new Error('HTTP '+r.status);
- return r.json();
- })
- .catch(function(){
- console.log('Proxy '+(index+1)+' failed, trying next...');
- return tryNext(index+1);
- });
- }
- return tryNext(0);
- }
- fetch(baseUrl+'/ads.txt')
- .then(function(r){
- if(!r.ok) throw new Error('ads.txt not found');
- return r.text();
- })
- .then(function(text){
- var pubIds=[];
- var lines=text.split('\n');
- lines.forEach(function(line){
- var match=line.match(/google\.com,\s*(pub-\d+)/i);
- if(match && match[1] && pubIds.indexOf(match[1])===-1){
- pubIds.push(match[1]);
- }
- });
- if(pubIds.length===0){
- setContent('<div class="error">No Google publisher IDs found in ads.txt</div>');
- return;
- }
- setContent('<div class="stats">Found '+pubIds.length+' Google publisher ID(s). Fetching details...</div>');
- tryProxies('https://storage.googleapis.com/adx-rtb-dictionaries/sellers.json')
- .then(function(data){
- var html='<ul>';
- var verified=0;
- pubIds.forEach(function(pubId){
- var seller=null;
- if(data && data.sellers){
- seller=data.sellers.find(function(s){
- return s.seller_id===pubId;
- });
- }
- if(seller){
- verified++;
- html+='<li><span class="pub-id">'+pubId+'</span><span class="pub-name">✓ '+seller.name+'</span></li>';
- }else{
- html+='<li><span class="pub-id">'+pubId+'</span><span class="not-found"> ⚠ Not found in Google database</span></li>';
- }
- });
- html+='</ul>';
- html='<div class="stats">✅ Verified: '+verified+' / '+pubIds.length+'</div>'+html;
- setContent(html);
- })
- .catch(function(err){
- console.error('Proxy error:',err);
- var html='<div class="stats">⚠️ Could not fetch seller names (proxy error)</div><ul>';
- pubIds.forEach(function(pubId,i){
- html+='<li><span class="pub-id">'+pubId+'</span> <em>(ID #'+(i+1)+')</em></li>';
- });
- 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>';
- setContent(html);
- });
- })
- .catch(function(err){
- setContent('<div class="error">Error: '+err.message+'</div>');
- });
- })();
Advertisement
Add Comment
Please, Sign In to add comment