Skip to content

Instantly share code, notes, and snippets.

@tylermenezes
Created June 9, 2023 00:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tylermenezes/aeaee3735fa4561a47eeb7696b6f97f2 to your computer and use it in GitHub Desktop.
Save tylermenezes/aeaee3735fa4561a47eeb7696b6f97f2 to your computer and use it in GitHub Desktop.
(() => {
const bookmarks = [...document.querySelectorAll('.entry')]
.filter((entry) => entry.querySelector('a.title'))
.map((entry) => {
const title = entry.querySelector('a.title').textContent;
const link = entry.querySelector('a.title').href;
const subreddit = entry.querySelector('.subreddit').textContent.replace('r/', '');
return `<DT><A HREF="${link}" PRIVATE="0" TOREAD="0" TAGS="${subreddit}">${title}</A>`;
});
console.log(`<!DOCTYPE NETSCAPE-Bookmark-file-1>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<TITLE>Bookmarks</TITLE>
<H1>Bookmarks</H1>
<DL><p>
${bookmarks.join(`\n`)}
</DL></p>`);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment