Skip to content

Instantly share code, notes, and snippets.

@mattdsteele
Created April 23, 2017 19:17
Show Gist options
  • Select an option

  • Save mattdsteele/89e0c65aba305b707a8f1e5654c0c5be to your computer and use it in GitHub Desktop.

Select an option

Save mattdsteele/89e0c65aba305b707a8f1e5654c0c5be to your computer and use it in GitHub Desktop.

Revisions

  1. mattdsteele created this gist Apr 23, 2017.
    1 change: 1 addition & 0 deletions README.md
    Original 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.
    27 changes: 27 additions & 0 deletions snippet.js
    Original 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}"`);
    }
    })();