recently youtube added "Send greeting card" function; breaking yt. make
yt more careful with parameter matching; as a result videos can fetch again ok jolan@
This commit is contained in:
parent
b27f0a8a21
commit
c8849c89e6
@ -1,8 +1,8 @@
|
||||
# $OpenBSD: Makefile,v 1.21 2008/11/04 04:14:50 jsg Exp $
|
||||
# $OpenBSD: Makefile,v 1.22 2009/01/05 18:44:37 martynas Exp $
|
||||
|
||||
COMMENT= customizable script to fetch youtube videos
|
||||
|
||||
PKGNAME= yt-9p0
|
||||
PKGNAME= yt-9p1
|
||||
CATEGORIES= net
|
||||
DISTFILES=
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/local/bin/lua
|
||||
-- $OpenBSD: yt.lua,v 1.15 2008/11/04 04:14:50 jsg Exp $
|
||||
-- $OpenBSD: yt.lua,v 1.16 2009/01/05 18:44:37 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
|
||||
@ -47,7 +47,7 @@ e_flv = string.format("%q", flv)
|
||||
e_mp4 = string.format("%q", mp4)
|
||||
|
||||
-- Look for the video ID.
|
||||
pattern = "/watch_fullscreen%?.*video_id=(.-)&"
|
||||
pattern = "/watch_fullscreen%?.*video_id=([^&\"]*)"
|
||||
video_id = string.match(body, pattern)
|
||||
|
||||
-- check for error such as "This video is not available in your country."
|
||||
@ -60,7 +60,7 @@ end
|
||||
|
||||
if video_id then
|
||||
--- Look for the additional video ID.
|
||||
pattern = "/watch_fullscreen%?.*&t=(.-)&"
|
||||
pattern = "/watch_fullscreen%?.*&t=([^&\"]*)"
|
||||
t = assert(string.match(body, pattern))
|
||||
url = string.format("%q", base_url .. "?video_id=" .. video_id
|
||||
.. "&t=" .. t .. fmt)
|
||||
|
Loading…
Reference in New Issue
Block a user