Moorad / youtube-video-downloader

199 stars 138 forks source link

Deployed to Zeit : But on submit page is not found // Works locally though, just not deployed #30

Open guntherkoo opened 4 years ago

guntherkoo commented 4 years ago

Saw your post on Medium and wanted to build one myself.

I deployed it here: https://ytdownloader-hmb8sypdc.vercel.app/

My server.js file looks like this:

`

    server.get('/download', async (req, res) => {
        try {
            let url = req.query.url;
            let info = await ytdl.getInfo(url);
            const video_title = info.videoDetails.title.replace(/\s+/g, '-');

            res.header('Content-Disposition', `attachment; filename="${video_title}.mp4"`);

            ytdl(url, {
                format: 'mp4',
                quality: 'highest',
            }).pipe(res);
        }

        catch (err) {
            console.log('Error locating video...', err);

            return app.render(req, res, '/404');
        }

    });

`

Thanks!

Moorad commented 4 years ago

so on zeit you have deployed index.html, right? if that is the case then you should also deploy the server script somewhere else. The approach demonstrated on the blog is having index.html deployed separate from the server, however, you can have it so that the index.html is directly served by the server which means you only have to deploy the server.

Moorad commented 4 years ago

Also sorry for the late reply

guntherkoo commented 4 years ago

@Moorad actually, I built the app in Typescript with Nextjs so it can deploy to Zeit/Now. Open to sharing the repo with you, sending the invite to Moorad now :)

Perhaps you can help me figure this out cause it's a bummer to not be able to use this on production and only locally...

Moorad commented 4 years ago

sure, I will look into it first thing tomorrow morning

guntherkoo commented 4 years ago

@Moorad did you get a chance to check my repo? Thanks!

Moorad commented 4 years ago

@guntherkoo I'm really really sorry, I got caught up with some irl stuff. Could you please resend the invite since it has expired

guntherkoo commented 4 years ago

Hi @Moorad , sorry took so long.. just added you to collab again.