Skip to content

Instantly share code, notes, and snippets.

@wlib
Last active August 17, 2020 18:49
Show Gist options
  • Select an option

  • Save wlib/cce00bee274347ca29375f0279603e00 to your computer and use it in GitHub Desktop.

Select an option

Save wlib/cce00bee274347ca29375f0279603e00 to your computer and use it in GitHub Desktop.

Revisions

  1. wlib revised this gist Aug 17, 2020. 2 changed files with 1 addition and 10 deletions.
    9 changes: 1 addition & 8 deletions gintama.js
    Original file line number Diff line number Diff line change
    @@ -1,15 +1,8 @@
    const https = require("https")

    const playerHTMLHandler = html => {
    const videoURL = html.match(/https:\/\/file\.gogocdn\.net.*?mp4/)[0]
    const viewDataURI = `data:text/html,<video controls src=${videoURL}></video>`
    console.log(viewDataURI)
    require("child_process").exec(`open "https://gistpreview.github.io/?cce00bee274347ca29375f0279603e00#${videoURL}"`)
    }

    const pageHTMLHandler = html => {
    const videoURL = html.match(/https:\/\/vidstreaming\.io\/load\.php\?id=.*?SUB/)[0]
    https.get(videoURL, requestHandler(playerHTMLHandler))
    require("child_process").exec(`open "${videoURL}"`)
    }

    const requestHandler = HTMLHandler => response => {
    2 changes: 0 additions & 2 deletions video.html
    Original file line number Diff line number Diff line change
    @@ -1,2 +0,0 @@
    <video controls></video>
    <script>document.querySelector("video").src = location.hash.slice(1)</script>
  2. wlib revised this gist Aug 17, 2020. 1 changed file with 25 additions and 0 deletions.
    25 changes: 25 additions & 0 deletions gintama.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    const https = require("https")

    const playerHTMLHandler = html => {
    const videoURL = html.match(/https:\/\/file\.gogocdn\.net.*?mp4/)[0]
    const viewDataURI = `data:text/html,<video controls src=${videoURL}></video>`
    console.log(viewDataURI)
    require("child_process").exec(`open "https://gistpreview.github.io/?cce00bee274347ca29375f0279603e00#${videoURL}"`)
    }

    const pageHTMLHandler = html => {
    const videoURL = html.match(/https:\/\/vidstreaming\.io\/load\.php\?id=.*?SUB/)[0]
    https.get(videoURL, requestHandler(playerHTMLHandler))
    }

    const requestHandler = HTMLHandler => response => {
    let html = ""
    response.on("data", chunk => html += chunk)
    response.on("end", () => HTMLHandler(html))
    }

    const getEpisode = episode =>
    https.get(`https://www8.gogoanimehub.tv/gintama-episode-${episode}`, requestHandler(pageHTMLHandler))


    getEpisode(parseInt(process.argv[2]))
  3. wlib created this gist Aug 17, 2020.
    2 changes: 2 additions & 0 deletions video.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,2 @@
    <video controls></video>
    <script>document.querySelector("video").src = location.hash.slice(1)</script>