From 20f619bb2dbed736de51245651b0321f46e73e94 Mon Sep 17 00:00:00 2001 From: Antti Ajanki Date: Tue, 26 Oct 2010 22:08:07 +0300 Subject: extract Youtube video params from the webpage, because get_video_info fails on copyright restricted videos --- templates/www.metacafe.com/navigation.xsl | 2 +- templates/www.youtube.com/description.xsl | 2 +- templates/www.youtube.com/navigation.xsl | 2 +- templates/www.youtube.com/video.xsl | 84 ------------------------------- templates/www.youtube.com/videopage.xsl | 74 ++++++++++++++++++++++++++- 5 files changed, 75 insertions(+), 89 deletions(-) delete mode 100644 templates/www.youtube.com/video.xsl diff --git a/templates/www.metacafe.com/navigation.xsl b/templates/www.metacafe.com/navigation.xsl index a4cb8e0..72e5d65 100644 --- a/templates/www.metacafe.com/navigation.xsl +++ b/templates/www.metacafe.com/navigation.xsl @@ -8,7 +8,7 @@ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> - wvt:///www.youtube.com/video.xsl?srcurl=http://www.youtube.com/get_video_info?video_id= + wvt:///www.youtube.com/videopage.xsl?srcurl=http://www.youtube.com/watch?v= wvt:///www.metacafe.com/videopage.xsl?srcurl= diff --git a/templates/www.youtube.com/description.xsl b/templates/www.youtube.com/description.xsl index 6567adb..453c152 100644 --- a/templates/www.youtube.com/description.xsl +++ b/templates/www.youtube.com/description.xsl @@ -64,7 +64,7 @@ - wvt:///www.youtube.com/video.xsl?srcurl=http://www.youtube.com/get_video_info?video_id= + wvt:///www.youtube.com/videopage.xsl?srcurl=http://www.youtube.com/watch?v= diff --git a/templates/www.youtube.com/navigation.xsl b/templates/www.youtube.com/navigation.xsl index 91f6189..0dd1fd8 100644 --- a/templates/www.youtube.com/navigation.xsl +++ b/templates/www.youtube.com/navigation.xsl @@ -11,7 +11,7 @@ - wvt:///www.youtube.com/video.xsl?srcurl=http://www.youtube.com/get_video_info?video_id= + wvt:///www.youtube.com/videopage.xsl?srcurl=http://www.youtube.com/watch?v= wvt:///www.youtube.com/description.xsl?srcurl= diff --git a/templates/www.youtube.com/video.xsl b/templates/www.youtube.com/video.xsl deleted file mode 100644 index 12e1cf5..0000000 --- a/templates/www.youtube.com/video.xsl +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <xsl:variable name="titleparam"> - <xsl:choose> - <xsl:when test="$title"> - <xsl:value-of select="$title"/> - </xsl:when> - <xsl:when test="contains(substring-after($videoinfo, '&title='), '&')"> - <xsl:value-of select="substring-before(substring-after($videoinfo, '&title='), '&')"/> - </xsl:when> - <xsl:otherwise> - <xsl:value-of select="substring-after($videoinfo, '&title=')"/> - </xsl:otherwise> - </xsl:choose> - </xsl:variable> - - <xsl:value-of select="str:decode-uri(str:replace($titleparam, '+', ' '))"/> - - - - - - - - - - - - - - - - diff --git a/templates/www.youtube.com/videopage.xsl b/templates/www.youtube.com/videopage.xsl index 5f1b174..a82583d 100644 --- a/templates/www.youtube.com/videopage.xsl +++ b/templates/www.youtube.com/videopage.xsl @@ -1,9 +1,79 @@ + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:str="http://exslt.org/strings" + xmlns:map="mapping" + exclude-result-prefixes="str map"> - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <xsl:variable name="titleparam"> + <xsl:choose> + <xsl:when test="$title"> + <xsl:value-of select="$title"/> + </xsl:when> + <xsl:when test="contains(substring-after($videoinfo, '&title='), '&')"> + <xsl:value-of select="substring-before(substring-after($videoinfo, '&title='), '&')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring-after($videoinfo, '&title=')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <xsl:value-of select="str:decode-uri(str:replace($titleparam, '+', ' '))"/> + + + + + + + + -- cgit v1.2.3