Created
April 23, 2017 19:17
-
-
Save mattdsteele/89e0c65aba305b707a8f1e5654c0c5be to your computer and use it in GitHub Desktop.
Revisions
-
mattdsteele created this gist
Apr 23, 2017 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ Papercall's free version doesn't have a public API, so this is a stupid simple way to get a pseudo-CSV of all the submissions on a page. This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ (() => { let submissions = document.querySelector('.table--stack').querySelectorAll('tbody tr'); const datum = []; for (const el of submissions) { const s = {}; const i = el.querySelector('td:first-child'); const url = i.querySelector('a:first-child').getAttribute('href'); const title = i.querySelector('a:first-child strong').textContent.trim(); let author = ''; for (const cn of i.childNodes) { if (cn.nodeType === 3) { author += cn.textContent.trim().replace(',',''); } } s.title = title; s.author = author; s.url = url; const location = i.querySelector('small'); if (location) { s.location = location.textContent.trim().replace('/',''); } datum.push(s); } for (const d of datum) { console.log(`"${d.title}","https://www.papercall.io${d.url}","${d.author}","${d.location}"`); } })();