From 1a7c069c64f3daaf1fa67951d3cbbe2be85a89a5 Mon Sep 17 00:00:00 2001 From: Antti Ajanki Date: Fri, 23 Jul 2010 22:45:50 +0300 Subject: Fix Youtube, use only only video URLs that really exist in fmt_url_map --- README.webvi | 7 ++- debian/webvi.1.txt | 7 ++- templates/youtube/navigation.xsl | 2 +- templates/youtube/video.xsl | 94 +++++++++++++++++++++++++--------------- 4 files changed, 70 insertions(+), 40 deletions(-) diff --git a/README.webvi b/README.webvi index 88f69eb..8dbf9a7 100644 --- a/README.webvi +++ b/README.webvi @@ -114,5 +114,8 @@ default is to download the best available version of the video. For Youtube, the available quality scores are: 50: standard quality (320x240, i.e. what you get in the web browser) - 60: medium quality (480x360 MP4) - 70: HD quality (720p) + 60: 480x360 MP4 + 65: 480p WebM + 70: 720p MP4 + 75: 720p WebM + 80: 1080p MP4 diff --git a/debian/webvi.1.txt b/debian/webvi.1.txt index 89140ed..416f35f 100644 --- a/debian/webvi.1.txt +++ b/debian/webvi.1.txt @@ -59,8 +59,11 @@ CONFIG FILE (section [site-youtube]): 50 standard quality (320x240, i.e. what you get in the web browser) - 60 medium quality (480x360 MP4) - 70 HD quality (720p) + 60 480x360 MP4 + 65 480p WebM + 70 720p MP4 + 75 720p WebM + 80 1080p MP4 AUTHOR This manual page was written by Tobias Grimm and diff --git a/templates/youtube/navigation.xsl b/templates/youtube/navigation.xsl index a5fd1c7..a9df76f 100644 --- a/templates/youtube/navigation.xsl +++ b/templates/youtube/navigation.xsl @@ -11,7 +11,7 @@ - wvt:///youtube/video.xsl?srcurl=http://www.youtube.com/watch?v= + wvt:///youtube/video.xsl?srcurl=http://www.youtube.com/get_video_info?video_id= wvt:///youtube/description.xsl?srcurl= diff --git a/templates/youtube/video.xsl b/templates/youtube/video.xsl index d38a99e..f2791da 100644 --- a/templates/youtube/video.xsl +++ b/templates/youtube/video.xsl @@ -1,47 +1,71 @@ - - - - - - - - - - - - - - - - - - - - - - - + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:str="http://exslt.org/strings" + xmlns:map="mapping" + exclude-result-prefixes="str map"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - <xsl:choose> - <xsl:when test="/html/head/meta[@name='title']/@content"> - <xsl:value-of select="/html/head/meta[@name='title']/@content"/> - </xsl:when> - <xsl:otherwise> - <xsl:value-of select="//div[@id='watch-vid-title']//h1"/> - </xsl:otherwise> - </xsl:choose> + <xsl:variable name="titleparam"> + <xsl:choose> + <xsl:when test="contains(substring-after(., '&title='), '&')"> + <xsl:value-of select="substring-before(substring-after(., '&title='), '&')"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="substring-after(., '&title=')"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + + <xsl:value-of select="str:decode-uri(str:replace($titleparam, '+', ' '))"/> - http://www.youtube.com/get_video?video_id=&t=&fmt=22 - http://www.youtube.com/get_video?video_id=&t=&fmt=18 - http://www.youtube.com/get_video?video_id=&t= + + + + -- cgit v1.2.3