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.
Created
April 23, 2017 19:17
-
-
Save mattdsteele/89e0c65aba305b707a8f1e5654c0c5be to your computer and use it in GitHub Desktop.
Screen Scrape Papercall.io
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
(() => { | |
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}"`); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment