Created
February 9, 2024 17:30
-
-
Save Wilman-es/a720794248cbc0b4e86514f27e4d7b98 to your computer and use it in GitHub Desktop.
Scrape keywords
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:!function(){if("undefined"==typeof XLSX){var e=document.createElement("script");e.type="text/javascript",e.src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.5/xlsx.full.min.js",document.head.appendChild(e),e.onload=function(){t()}}else t();function t(){var e=[],t=document.querySelectorAll(".clamp-word"),n="",o=[".com",".es","es/",".com/","html","="];t.forEach(function(t){var a=t.textContent.trim().replace(/\s+/g," ");o.some(function(e){return a.includes(e)})||a===n||a.includes("-")||a.includes("/")||(e.push(a),n=a)});document.querySelectorAll(".data-table tbody tr").forEach(function(e){e.insertAdjacentHTML("beforeend",'<td class="no-border-right table-cell-number text-right" colspan="1" style="width: 40px;"> </td>')});var a=document.createElement("ul");e.forEach(function(e){var t=document.createElement("li");t.textContent=e,a.appendChild(t)});var l=document.createElement("button");l.textContent="Descargar Excel",l.style.marginBottom="10px",l.addEventListener("click",function(){var t,n,o;t=e,n=XLSX.utils.aoa_to_sheet(t.map(function(e){return[e]})),o=XLSX.utils.book_new(),XLSX.utils.book_append_sheet(o,n,"Datos"),XLSX.writeFile(o,"datos_excel.xlsx")});var c=window.open();c.document.body.appendChild(l),c.document.body.appendChild(a)}}(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add the script to your bookmarklet and run.