Skip to content
This repository has been archived by the owner on Dec 3, 2023. It is now read-only.

twitch VOD download not working #305

Open
keja opened this issue Apr 24, 2020 · 3 comments
Open

twitch VOD download not working #305

keja opened this issue Apr 24, 2020 · 3 comments

Comments

@keja
Copy link

keja commented Apr 24, 2020

Hello,

Im facing some issues when i try to get a Twitch video, it works perfect when i use the binary file, so i expect the following code to work:

const VOD = youtubedl("https://www.twitch.tv/videos/598800710");

yet i produces a file that is 758bytes, and it is a 40min video.

i dont know if this is a bug, or im not getting something right ?

here is what i have tried:

const youtubedl = require('youtube-dl');
const fs = require('fs');
const exec = require('child_process').exec;

(async () => {
    const urls = [
        "https://www.youtube.com/watch?v=dQw4w9WgXcQ", 
        "https://www.twitch.tv/videos/598800710"
    ];

    console.log('using youtubedl');
    for(const idx in urls){
        await new Promise(r => {
            const video = youtubedl(urls[idx]);
            video.on('info', function(info) {
                console.log(`  ${info.extractor} -> ${urls[idx]}`);
                video.pipe(fs.createWriteStream(`file_a_${idx}.mp4`));
            })
            video.on('end', function(){
                console.log(`  file size: ${fs.statSync(`file_a_${idx}.mp4`).size}`);
                console.log();
                r();
            })
        });
    }
    

    console.log('using bin');
    for(const idx in urls){
        await new Promise(r => {

            console.log(`  ${urls[idx]}`);
            const child = exec(`${youtubedl.getYtdlBinary()} -o "file_b_${idx}.mp4" -f "[ext=mp4]" "${urls[idx]}"`);
            child.on('exit', () => {
                const s = fs.statSync(`file_b_${idx}.mp4`).size;
                console.log(`  file size: ${s}`);
                console.log();
                r();
            });
            
        });
    }
})();

and the output is

using youtubedl
  youtube -> https://www.youtube.com/watch?v=dQw4w9WgXcQ
  file size: 15929856

  twitch:vod -> https://www.twitch.tv/videos/598800710
  file size: 758

using bin
  https://www.youtube.com/watch?v=dQw4w9WgXcQ
  file size: 15929856

  https://www.twitch.tv/videos/598800710
  file size: 1857375989
@ghost
Copy link

ghost commented Jun 16, 2020

see #294

@keja
Copy link
Author

keja commented Jun 17, 2020

see #294

Thanks!

@masudhossain
Copy link

@keja were you able to fix this twitch video download issue?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants