fent / node-ytdl-core

YouTube video downloader in javascript.
MIT License
4.54k stars 803 forks source link

Unable to access video using the url provided by ytdl getting 403 error #1311

Open Aliyan-Ansari opened 2 months ago

Aliyan-Ansari commented 2 months ago

Hi Team, link is generated against this video (https://youtube.com/shorts/6QulIvGWHJ0?si=EbogTUADbI69Gudi) But when i try to access it on browser or using my react native library it is not accessible. getting:

"Access to rr2---sn-jtcxg-3ip6.googlevideo.com was denied. You don't have authorization to view this page. HTTP ERROR 403"

https://rr2---sn-jtcxg-3ip6.googlevideo.com/videoplayback?expire=1725642600&ei=COPaZqSOH5mEjuMP94yc6Qw&ip=103.244.174.18&id=o-AFaBYjoKUHPNZJ8oWGFxgOr2v7tlwjjvUpxiB33WXpuF&itag=133&aitags=133%2C134%2C135%2C136%2C137%2C160%2C242%2C243%2C244%2C247%2C248%2C278%2C394%2C395%2C396%2C397%2C398%2C399%2C779%2C780&source=youtube&requiressl=yes&xpc=EgVo2aDSNQ%3D%3D&mh=2g&mm=31%2C29&mn=sn-jtcxg-3ip6%2Csn-hju7enll&ms=au%2Crdu&mv=m&mvi=2&pcm2cms=yes&pl=24&initcwndbps=568750&bui=AQmm2ezHIw9DrFLNJy1DcUiXcqInN9g_cwe6kZ84rh3FxkWVVkdGHHjppb8IJpm60PWMO72qr2r7RAnt&spc=Mv1m9vapa1cw0PUX5IBpidXlN8jZ96GSxe_6AHUJq7INAY7Tc3pbWerPQGo0&vprv=1&svpuc=1&mime=video%2Fmp4&ns=O8PF1ZkAvNRNpWGmYHcJW9AQ&rqh=1&gir=yes&clen=1830132&dur=59.799&lmt=1717677759727101&mt=1725620468&fvip=1&keepalive=yes&c=WEB&sefc=1&txp=453C434&n=_sI3KXedMZm5LcK3S&sparams=expire%2Cei%2Cip%2Cid%2Caitags%2Csource%2Crequiressl%2Cxpc%2Cbui%2Cspc%2Cvprv%2Csvpuc%2Cmime%2Cns%2Crqh%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpcm2cms%2Cpl%2Cinitcwndbps&lsig=ABPmVW0wRQIhAO_saod5onpZ_M8_OvBbZmR-qpWPHflLZkh9MRL7xJR-AiBre4OciC3Sk3ozSfENL9nakk9CPzWH8vffclma8GeKUg%3D%3D&sig=AJfQdSswRAIgckRZLqHBE8x_A3ITp0HxXdEILvogRsdhFZUVsJuem3ICIHs54jAZiMHfZzdpxAeUQtpc-fPO1RH_qY16QkUR6MQQ

my code is: exports.getVideoInfo = async (req, res) => { try { const videoUrl = req.query.url; // Get video URL from request query parameter if (!videoUrl) { return res.status(400).json({ message: "Missing video URL" }); } const info = await ytdl.getInfo(videoUrl); // Extract relevant information for the frontend const availableFormats = info.formats.map((format) => ({ itag: format.itag, mimeType: format.mimeType, container: format.container, audioBitrate: format.audioBitrate, videoBitrate: format.videoBitrate, height: format.height, width: format.width, approxSize: format.approxSize, })); return res .status(200) .json({ availableFormats, videoTitle: info.videoDetails.title }); } catch (error) { console.error(error); return res .status(500) .json({ message: "Error fetching video information" }); } };

stuartjing commented 2 months ago

Hello, has this problem been solved, or is there any other solution? Thanks