ytdl-js / react-native-ytdl

A YouTube downloader for React Native

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Library stopped working suddenly...

alexmercerind opened this issue · comments

Using following code:

let mode = 140
let video_url = new Promise(function (resolve, reject) {

    ytdl.getInfo(video_id, {}, (error, response) => {
        for (let index in response.formats) {
            if (response.formats[index].itag == mode) {
                resolve(response.formats[index].url);
                break;
            };
        };
    });
});

video_url
.then((url) => console.log(url));
TypeError: Cannot read property 'formats' of undefined
TypeError: Cannot read property 'formats' of undefined
    at anonymous (http://192.168.43.146:8081/index.bundle?platform=android&dev=true&minify=false:110017:43)
    at anonymous (http://192.168.43.146:8081/index.bundle?platform=android&dev=true&minify=false:110466:35)
    at anonymous (http://192.168.43.146:8081/index.bundle?platform=android&dev=true&minify=false:110338:31)
    at anonymous (http://192.168.43.146:8081/index.bundle?platform=android&dev=true&minify=false:110466:35)
    at anonymous (http://192.168.43.146:8081/index.bundle?platform=android&dev=true&minify=false:110251:15)
    at tryCallOne (http://192.168.43.146:8081/index.bundle?platform=android&dev=true&minify=false:28860:16)
    at anonymous (http://192.168.43.146:8081/index.bundle?platform=android&dev=true&minify=false:28961:27)
    at apply (native)
    at anonymous (http://192.168.43.146:8081/index.bundle?platform=android&dev=true&minify=false:32510:26)
    at _callTimer (http://192.168.43.146:8081/index.bundle?platform=android&dev=true&minify=false:32400:17)
    at _callImmediatesPass (http://192.168.43.146:8081/index.bundle?platform=android&dev=true&minify=false:32436:19)
    at callImmediates (http://192.168.43.146:8081/index.bundle?platform=android&dev=true&minify=false:32654:33)
    at __callImmediates (http://192.168.43.146:8081/index.bundle?platform=android&dev=true&minify=false:2719:35)
    at anonymous (http://192.168.43.146:8081/index.bundle?platform=android&dev=true&minify=false:2505:34)
    at __guard (http://192.168.43.146:8081/index.bundle?platform=android&dev=true&minify=false:2702:15)
    at flushedQueue (http://192.168.43.146:8081/index.bundle?platform=android&dev=true&minify=false:2504:21)
    at invokeCallbackAndReturnFlushedQueue (http://192.168.43.146:8081/index.bundle?platform=android&dev=true&minify=false:2497:33)

P.S.
console.log of error gives this:

[Error: Error parsing config: JSON Parse error: Unexpected token: ;]