Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Checks if the title of the result in the SERP matches the title of the URL
javascript: (function (doc){var changed=0; function checkTitles(){console.log('jQuery version ', $.fn.jquery, ' loaded'); var position=1; var items=[]; var results=$('#rso .kp-blk .g, #rso .g[class="g"], #rso .srg .g').not('.kno-kp .g').find('div:first').find('a:first'); $('.title-changed, #CountTitlesChanged').remove(); results.each(function (){if (!$(this).parents('.related-question-pair').length){var parent=$(this).closest('.tF2Cxc').length > 0 ? $(this).closest('.tF2Cxc') : $(this).closest('li'); items.push([ position, $(this).find('h3').text(), encodeURI($(this).attr('href')), parent]); position++;}}); var numItems=1; cors_proxies=[ 'https://api.codetabs.com/v1/proxy?quest=', 'https://jsonp.afeld.me/?url=',]; items.forEach(item=>{$.ajax({url: cors_proxies[Math.floor(Math.random() * cors_proxies.length)] + item[2], success: function (data, status, xhr){title=$(data).filter('title').text(); var html='<div class="title-changed">'; if (title !=item[1]){html +='<span style="font-weight: bold;color: #ff6961;">' + title + '</span>'; changed++;}else{html +='<span style="font-weight: bold;color: darkgreen;">' + item[1] + '</span>';}html +='</div>'; item[3].find('div').first().append(html);}, error: function (xhr, status, error){var html='<div class="title-changed">'; html +='<span style="font-weight: bold;color: lightslategray;">Error: No se ha podido procesar la solicitud</span>'; html +='</div>'; item[3].find('div').first().append(html);}, complete: function (xhr, status){if (numItems==items.length){petitionCompleted();}else{numItems++;}}});});}function petitionCompleted(){$('#result-stats').append('<span id="CountTitlesChanged"> - ' + changed + ' títulos cambiados en esta página</span>');}if (typeof jQuery=='undefined'){var script_jQuery=document.createElement('script'); script_jQuery.src='https://code.jquery.com/jquery-latest.min.js'; script_jQuery.onload=checkTitles; doc.body.appendChild(script_jQuery); console.log('script_jQuery appended to body');}else{console.log('jQuery already included ...'); checkTitles();}})(document)
@fedegomez

This comment has been minimized.

Copy link
Owner Author

@fedegomez fedegomez commented Aug 26, 2021

image

@faisalrafique21

This comment has been minimized.

Copy link

@faisalrafique21 faisalrafique21 commented Aug 28, 2021

@fedegomez Kindly can you tell me how to install or configure it on the browser??

@fedegomez

This comment has been minimized.

Copy link
Owner Author

@fedegomez fedegomez commented Aug 29, 2021

@fedegomez Kindly can you tell me how to install or configure it on the browser??

Just drag the code to the browser's bookmark bar, or create a new bookmark and paste the code in the URL field. Then when you do a search, just click on the bookmark and it will return the original titles.

meta-bookmarklet
GIF by Jens Polomski
(https://jens.marketing/google-meta-title-ueberpruefen/)

@neximuss

This comment has been minimized.

Copy link

@neximuss neximuss commented Aug 29, 2021

Thank you, very useful, but still with some ugly bugs:
Bildschirmfoto 2021-08-30 um 00 22 47
Bildschirmfoto 2021-08-30 um 00 22 33

@jmfelip

This comment has been minimized.

Copy link

@jmfelip jmfelip commented Aug 30, 2021

Hey Fede, really nice one!
Many thanks for sharing :-)

@jblanch2018

This comment has been minimized.

Copy link

@jblanch2018 jblanch2018 commented Aug 30, 2021

Si los sitios tienen protección por cloudflare no muestra el title "escrapeado" por lo demás funciona perfectamente!

@rootxnaresh

This comment has been minimized.

Copy link

@rootxnaresh rootxnaresh commented Aug 31, 2021

Thanks for this tool, really helpful. 👏

@arvindsoniindia

This comment has been minimized.

Copy link

@arvindsoniindia arvindsoniindia commented Sep 2, 2021

Well done it will really help SEO professionals
Thanks for sharing it

@yashlohade21

This comment has been minimized.

Copy link

@yashlohade21 yashlohade21 commented Sep 2, 2021

Thanks For This

@priyansh1001

This comment has been minimized.

Copy link

@priyansh1001 priyansh1001 commented Sep 2, 2021

Hey, I am not getting the proper view, can some one suggest me what to do?
Only 1st one is proceed, no effect from 2nd result.

image

@chrishaensel

This comment has been minimized.

Copy link

@chrishaensel chrishaensel commented Sep 3, 2021

Thank you, very useful, but still with some ugly bugs:
Bildschirmfoto 2021-08-30 um 00 22 47
Bildschirmfoto 2021-08-30 um 00 22 33

The webiste you're showing in your screenshot is using the charset=iso-8859-1, as you can see in the source. If it were to use utf8, everything would be fine :) So I don't think it's a task for Fede to cope with this :)

@naruto-chelsea

This comment has been minimized.

Copy link

@naruto-chelsea naruto-chelsea commented Sep 3, 2021

How do i do this in safari on mac?

@anskari1972

This comment has been minimized.

Copy link

@anskari1972 anskari1972 commented Sep 3, 2021

Fede, Gracias!!! 🙏🙌👏

@mikkellauge

This comment has been minimized.

Copy link

@mikkellauge mikkellauge commented Sep 3, 2021

Very nice tool. Can you tell, why some results gets these error?
image

@jaegermark

This comment has been minimized.

Copy link

@jaegermark jaegermark commented Sep 4, 2021

@mikkellauge Read here: https://www.simply.com/dk/support/faq/php/36/ (in Danish). You have to deactivate your web host's Web Application Firewall.

@mikkellauge

This comment has been minimized.

Copy link

@mikkellauge mikkellauge commented Sep 6, 2021

Thanks @jaegermark :)

@jrosell

This comment has been minimized.

Copy link

@jrosell jrosell commented Sep 8, 2021

No conocia estos proxies que usas y me parece una idea genial para ir rapidito con javascript. Gracias @fedegomez

@Dasuhalder

This comment has been minimized.

Copy link

@Dasuhalder Dasuhalder commented Sep 11, 2021

this code is not working on Mac, please help.

@yehia-hacker

This comment has been minimized.

Copy link

@yehia-hacker yehia-hacker commented Sep 19, 2021

I can improve this code to work properly
better and faster
If interested: https://twitter.com/yehia_online

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment