jgreco / mpv-youtube-quality

A userscript for MPV that allows you to change youtube video quality (ytdl-format) on the fly
370 stars 36 forks source link

Fetching formats failed #28

Open Rafee-M opened 2 years ago

Rafee-M commented 2 years ago

When pressing Ctrl + f gives out an error

image

benyaminl commented 2 years ago

I also experience the same. does this only works on linux?

I think this problem raise because we users use ytdlp, and at line 196-210 on .lua script is really depends on the youtube-dl, lead to broken downloading format. hmm.. Let me try to see if changing to yt-dlp.exe works

EDIT: Yes it works if we replace youtube-dl to yt-dlp on line 164.

Is there anyway to bind this config to .conf file?

@jgreco ? as Youtube-dl already abandoned by the author itself.. and spin off as yt-dlp? Prove : lua script image the GUI result image

Rafee-M commented 2 years ago

@benyaminl I've changed it and I still get the same error

benyaminl commented 2 years ago

Does yt-dlp is included on windows env PATH? If no the error will raise.. so please try to check it. Check also if yoy are using ytdl or ytdlp.

Regards, Benyamin Limanto sent from my Sony XPERIA XZ Premium

On Tue, 1 Feb 2022, 22:25 RafeeDaBoy, @.***> wrote:

@benyaminl https://github.com/benyaminl I've changed it and I still get the same error

— Reply to this email directly, view it on GitHub https://github.com/jgreco/mpv-youtube-quality/issues/28#issuecomment-1026964922, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAVP2NFNGEFGG2WYZXGHUKDUY73NDANCNFSM5NEXWIYA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

Rafee-M commented 2 years ago

Moving it from the mpv's install directory to ~\AppData\Roaming\mpv\scripts solved the issue, along with changing youtube-dl to yt-dlp on line 164. Thanks!

benyaminl commented 2 years ago

@RafeeDaBoy I think yt-dlp path should be tested on cmd first, because I've yt-dlp and mpv on same folder and I put it on env path, then it works. Please remember that when you change env path, you need to restart, as lua/python can't detect automatically

I think this issue should kept open as we need to adopt it as conf.

ping @jgreco

Rafee-M commented 2 years ago

Yes, I had checked if yt-dlp and mpv was working in cmd and it was.

And I've reopened the issue.

arktnld commented 1 year ago

Made this code to fix this error

-- Function to check if a command is executable
function isExecutable(command)
    local f = io.popen("which " .. command)
    local path = f:read("*a")
    f:close()
    return string.len(path) > 0
end

-- Check if youtube-dl or yt-dlp is in PATH
if isExecutable("youtube-dl") then
    yt_tool = "youtube-dl"
elseif isExecutable("yt-dlp") then
    yt_tool = "yt-dlp"
end

local ytdl = {
    path = yt_tool,
    searched = false,
    blacklisted = {}
}
benyaminl commented 1 year ago

@arktnld I think you need to make a PR, so @jgreco could see it. Hopefully it will be updated. Thanks for the heads up @arktnld

arktnld commented 1 year ago

@benyaminl done #32

subhanshu1111 commented 1 year ago

Made this code to fix this error

-- Function to check if a command is executable
function isExecutable(command)
    local f = io.popen("which " .. command)
    local path = f:read("*a")
    f:close()
    return string.len(path) > 0
end

-- Check if youtube-dl or yt-dlp is in PATH
if isExecutable("youtube-dl") then
    yt_tool = "youtube-dl"
elseif isExecutable("yt-dlp") then
    yt_tool = "yt-dlp"
end

local ytdl = {
    path = yt_tool,
    searched = false,
    blacklisted = {}
}

where do i add this inside my lua script? at the end of file? edit: I added your lua script from pull request you made but still doesnt work on macos

arktnld commented 1 year ago

edit: I added your lua script from pull request you made but still doesnt work on macos

@subhanshu1111 First, test if these commands are working:

youtube-dl -F {URL}

or

yt-dlp -F {URL}

Sometimes youtube-dl or yt-dlp don't work correctly.

IlgazC commented 1 year ago

I am having this problem on openSUSE TW and I also removed the unmaintained youtube-dl and use yt-dl only which is in /usr/bin

Here is the result of -F yt-dlp -F https://www.youtube.com/watch?v=P-8C-f1flcw [youtube] Extracting URL: https://www.youtube.com/watch?v=P-8C-f1flcw [youtube] P-8C-f1flcw: Downloading webpage [youtube] P-8C-f1flcw: Downloading ios player API JSON [youtube] P-8C-f1flcw: Downloading android player API JSON [youtube] P-8C-f1flcw: Downloading m3u8 information [youtube] P-8C-f1flcw: Downloading m3u8 information [youtube] P-8C-f1flcw: Downloading m3u8 information [info] Available formats for P-8C-f1flcw: ID EXT RESOLUTION FPS │ TBR PROTO │ VCODEC VBR ACODEC MORE INFO ───────────────────────────────────────────────────────────────────────────── 233 mp4 audio only │ m3u8 │ audio only unknown Default 234 mp4 audio only │ m3u8 │ audio only unknown Default 269 mp4 256x144 15 │ 290k m3u8 │ avc1.42C00B 290k video only 91 mp4 256x144 15 │ 290k m3u8 │ avc1.42c00b mp4a.40.5 229 mp4 426x240 30 │ 546k m3u8 │ avc1.4D4015 546k video only 92 mp4 426x240 30 │ 546k m3u8 │ avc1.4d4015 mp4a.40.5 230 mp4 640x360 30 │ 1210k m3u8 │ avc1.4D401E 1210k video only 93 mp4 640x360 30 │ 1210k m3u8 │ avc1.4d401e mp4a.40.2 231 mp4 854x480 30 │ 1569k m3u8 │ avc1.4D401F 1569k video only 94 mp4 854x480 30 │ 1569k m3u8 │ avc1.4d401f mp4a.40.2 232 mp4 1280x720 30 │ 2969k m3u8 │ avc1.4D401F 2969k video only 95 mp4 1280x720 30 │ 2969k m3u8 │ avc1.4d401f mp4a.40.2