yt.VideoQualityConstants.HIGH may not be enough; be safe and always
fetch low-quality, except when 6 is matched in fmt_list -- in this case we are sure that high-quality format is available links provided, much tested by Henrikas Judickas <Henrikas.Judickas at mif.stud.vu.lt>. Thanks! ok jsg@
This commit is contained in:
parent
67229b2361
commit
503831fbde
@ -1,8 +1,8 @@
|
||||
# $OpenBSD: Makefile,v 1.23 2009/01/06 12:35:27 sthen Exp $
|
||||
# $OpenBSD: Makefile,v 1.24 2009/01/06 18:48:17 martynas Exp $
|
||||
|
||||
COMMENT= customizable script to fetch youtube videos
|
||||
|
||||
PKGNAME= yt-9p2
|
||||
PKGNAME= yt-9p3
|
||||
CATEGORIES= net www
|
||||
DISTFILES=
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!${LOCALBASE}/bin/lua
|
||||
-- $OpenBSD: yt.lua,v 1.17 2009/01/06 12:35:27 sthen Exp $
|
||||
-- $OpenBSD: yt.lua,v 1.18 2009/01/06 18:48:17 martynas Exp $
|
||||
-- Fetch videos from YouTube.com and convert them to MPEG.
|
||||
-- Written by Pedro Martelletto in August 2006. Public domain.
|
||||
-- Example: lua yt.lua http://www.youtube.com/watch?v=c5uoo1Kl_uA
|
||||
@ -30,8 +30,9 @@ pattern = "<title>(.-)</title>"
|
||||
title = assert(string.match(body, pattern))
|
||||
|
||||
-- Fetch high quality if available
|
||||
if (string.match(body, "yt.VideoQualityConstants.HIGH") ~= nil) then
|
||||
fmt = "&fmt=6"
|
||||
if (string.match(body, "yt.VideoQualityConstants.HIGH") ~= nil) and
|
||||
(string.match(body, "/watch_fullscreen%?.*fmt_map=[^&]*6[^&]*&") ~= nil) then
|
||||
fmt = "%&fmt=6"
|
||||
else
|
||||
fmt = ""
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user