Skip to content

Instantly share code, notes, and snippets.

@nrm176
Last active May 12, 2020 08:39
Show Gist options
  • Save nrm176/ef5480321478f6d7f3e3a1b8b4fbf1d4 to your computer and use it in GitHub Desktop.
Save nrm176/ef5480321478f6d7f3e3a1b8b4fbf1d4 to your computer and use it in GitHub Desktop.

Extract information from 19tv

Array.from(document.querySelectorAll('table.tables tr')).map((e) => {
    return {
        id: e.querySelector('td:nth-child(1)'),
        content: e.querySelector('td:nth-child(3)'),
        pdfUrl: e.querySelector('td:nth-child(4) a')
    }
}).filter((e) => {
    return e.content !== null
}).map((e) => {
    return {
        id: e.id.textContent,
        title: e.content.querySelector('a').textContent,
        desc: e.content.querySelector('span').textContent,
        videoUrl: e.content.querySelector('a').href,
        pdfUrl: e.pdfUrl.href}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment