Skip to content

Instantly share code, notes, and snippets.

@kamiazya
Last active June 7, 2019 01:59
Show Gist options
  • Select an option

  • Save kamiazya/45c529ba14cb88ff53c37b2ad7d912b8 to your computer and use it in GitHub Desktop.

Select an option

Save kamiazya/45c529ba14cb88ff53c37b2ad7d912b8 to your computer and use it in GitHub Desktop.
aタグのタイトルとURLをCSVで書き出すブックマークレット
javascript:(function () {
const list = [];
for (let e of document.getElementsByTagName('a')) {
list.push(e.textContent.trim() + ',' + e.getAttribute('href').trim());
}
const bom = new Uint8Array([0xEF, 0xBB, 0xBF]);
const content = list.join('\n');
const blob = new Blob([bom, content], { type: 'text/csv' });
const aTag = document.createElement('a');
aTag.href = window.URL.createObjectURL(blob);
aTag.click();
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment