ybd-project / ytdl-core

Fast and secure YouTube downloader for JavaScript and TypeScript
MIT License
28 stars 5 forks source link

Simple questions can be asked here #12

Closed ybd-project closed 2 months ago

ybd-project commented 2 months ago

The answer to this brief question has been moved to Discussion. Here

awnigharbia commented 2 months ago

I have used yt-dlp and have acceess to m3u8_native property, How can I access it using this package?

ybd-project commented 2 months ago

I have used yt-dlp and have acceess to m3u8_native property, How can I access it using this package?

Thank you for your comment. Is there a video URL that contains the m3u8_native property?

awnigharbia commented 2 months ago

Every youtube video contains this proeprty. using this command yt-dlp -J videoID will log out json containts m3u8_native

awnigharbia commented 2 months ago

Video id: YxkcMszKEYY

m3u8_native link: https://manifest.googlevideo.com/api/manifest/hls_variant/expire/1725887093/ei/FZ7eZtGFIOe4mLAPrO3HuAE/ip/83.244.76.34/id/63191c32ccca1186/source/youtube/requiressl/yes/xpc/EgVo2aDSNQ%3D%3D/playback_host/rr4---sn-25auxa-1qhee.googlevideo.com/mh/t5/mm/31%2C29/mn/sn-25auxa-1qhee%2Csn-hgn7rn7r/ms/au%2Crdu/mv/m/mvi/4/pcm2cms/yes/pl/24/hfr/1/demuxed/1/tts_caps/1/maudio/1/initcwndbps/412500/vprv/1/go/1/rqh/5/mt/1725865260/fvip/5/nvgoi/1/short_key/1/ncsapi/1/keepalive/yes/dover/13/itag/0/playlist_type/DVR/sparams/expire%2Cei%2Cip%2Cid%2Csource%2Crequiressl%2Cxpc%2Chfr%2Cdemuxed%2Ctts_caps%2Cmaudio%2Cvprv%2Cgo%2Crqh%2Citag%2Cplaylist_type/sig/AJfQdSswRQIhANfUl6Lo04O8ljbMdYtMgnEH3V3hlOBybv82wb9IBPPLAiAHloBjNmTvzfFdeB5kDBLWtOWeF-Mv-kzrE9DQGoqaig%3D%3D/lsparams/playback_host%2Cmh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpcm2cms%2Cpl%2Cinitcwndbps/lsig/ABPmVW0wRQIgWWeICpk8npoeFhPZ_MgDJaSvuh6QcY0o9-Y5hGP-PzsCIQCUN5vqJZhXKrhFKR9Y8nB_jvF4s4AeYP4k7Ug-MNG6Hw%3D%3D/file/index.m3u8

ybd-project commented 2 months ago

The current ytdl-core does not parse m3u8 manifest files, so the m3u8 format is never included in the data. In the future, we would like to implement it so that it does parse them.

awnigharbia commented 2 months ago

Okay. out of scope,

How to pass oauth2 or poToken and visitorData to yt-dlp. Any suggestions?

ybd-project commented 2 months ago

Okay. out of scope,

How to pass oauth2 or poToken and visitorData to yt-dlp. Any suggestions?

I understand. Here is the code. (TypeScript)

import { YtdlCore } from '@ybd-project/ytdl-core';

const ytdl = new YtdlCore({
    poToken: 'YOUR PO TOKEN',
    visitorData: 'YOUR VISITOR DATA',
    oauth2: new YtdlCore.OAuth2({
        accessToken: 'YOUR ACCESS TOKEN',
        refreshToken: 'YOUR REFRESH TOKEN',
        expiryDate: 'YYYYY-mm-DDTHH:MM:SSZ',
    }),
});

// Get information
ytdl.getFullInfo('https://www.youtube.com/watch?v=VIDEO_ID');
awnigharbia commented 2 months ago

Okay. out of scope, How to pass oauth2 or poToken and visitorData to yt-dlp. Any suggestions?

I understand. Here is the code. (TypeScript)

import { YtdlCore } from '@ybd-project/ytdl-core';

const ytdl = new YtdlCore({
    poToken: 'YOUR PO TOKEN',
    visitorData: 'YOUR VISITOR DATA',
    oauth2: new YtdlCore.OAuth2({
        accessToken: 'YOUR ACCESS TOKEN',
        refreshToken: 'YOUR REFRESH TOKEN',
        expiryDate: 'YYYYY-mm-DDTHH:MM:SSZ',
    }),
});

// Get information
ytdl.getFullInfo('https://www.youtube.com/watch?v=VIDEO_ID');

Thanks a lot.

I meant yt-dlp not this package.

ybd-project commented 2 months ago

Oh, it was yt-dlp, I don't think I see a way to pass it to yt-dlp. Note that this brief FAQ has been moved to Discussion. We will no longer be able to comment on this Issue.