Skip to content

Instantly share code, notes, and snippets.

@stefanschmidt
Last active March 9, 2022 19:12
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 stefanschmidt/0c87931f366967b4ab1f4c08d36680e8 to your computer and use it in GitHub Desktop.
Save stefanschmidt/0c87931f366967b4ab1f4c08d36680e8 to your computer and use it in GitHub Desktop.
Batch re-crawl all Pinboard bookmarks that show an error 500 instead of a link to an archived copy
/*
1. Open https://pinboard.in/u:account/code:500 in browser
2. Maximize the number of displayed bookmarks per page (160)
3. Open the JavaScript Console in browser
4. Paste the below snippet to re-crawl all links with error 500
5. Refresh browser and repeat as needed
*/
const list = document.querySelectorAll('a[title="Click to re-crawl this link"]');
const regexp = /mark_for_recrawl\(this, (\d+), '([0-9a-f]+)'\);return false;/g;
var str
var matches
for (let i = 0; i < list.length; i++) {
str = list[i].outerHTML
matches = [...str.matchAll(regexp)];
mark_for_recrawl(list[i], parseInt(matches[0][1], 10), matches[0][2].toString);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment