Last active
July 8, 2024 04:13
-
-
Save solace/0989a1548a4ad994c67feb316738e81e to your computer and use it in GitHub Desktop.
A bookmarklet to clip Tumblr posts
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:navigator.clipboard.write([new ClipboardItem({ ["text/html"]: new Blob([`---<br />created: "${new Date().toISOString()}"<br />published: "${document.querySelector('time').dateTime}"<br />authors: ${document.querySelector('a[rel="author"]').text}<br />url: ${window.location}<br /><br />---<br /><br /># ${document.querySelector('link[type="application/json+oembed"]').title} <br /><br />` + document.querySelectorAll(`[data-id="${window.location.pathname.match(/(\d+)/)[1]}"] article > div`)[0].outerHTML.replace(/srcset="(.*?)"/g, (matcher,p1) => { const last = p1.split(/\s*,\s*/).pop(); return `src="${last.split(/\s+/)[0]}"`})], {type: 'text/html'})})]).then(() => console.log('Copied to clipboard')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See: https://micheleong.com/blog/tumblr-web-clipper