diff options
author | Antti Ajanki <antti.ajanki@iki.fi> | 2012-09-23 21:01:59 +0300 |
---|---|---|
committer | Antti Ajanki <antti.ajanki@iki.fi> | 2012-09-23 21:01:59 +0300 |
commit | 9dc83402c2162fe0be4e748a39613ebaaa0fd169 (patch) | |
tree | 505bdd250fa485067941f3ac174ad80b4640fc8d /templates | |
parent | 23f374f8fbad7de8e39e45b0e53400cff078f139 (diff) | |
download | vdr-plugin-webvideo-9dc83402c2162fe0be4e748a39613ebaaa0fd169.tar.gz vdr-plugin-webvideo-9dc83402c2162fe0be4e748a39613ebaaa0fd169.tar.bz2 |
Fix Google video
Diffstat (limited to 'templates')
-rw-r--r-- | templates/video.google.com/search.xsl | 16 | ||||
-rw-r--r-- | templates/video.google.com/searchresults.xsl | 47 | ||||
-rw-r--r-- | templates/video.google.com/videopage.xsl | 19 |
3 files changed, 23 insertions, 59 deletions
diff --git a/templates/video.google.com/search.xsl b/templates/video.google.com/search.xsl index 07dbda6..ce68861 100644 --- a/templates/video.google.com/search.xsl +++ b/templates/video.google.com/search.xsl @@ -12,23 +12,9 @@ <label>Search terms</label> </textfield> - <itemlist name="so"> - <label>Sort by</label> - <item value="">Relevance</item> - <item value=",sbd:1">Date</item> - </itemlist> - - <itemlist name="dur"> - <label>Duration</label> - <item value="">All durations</item> - <item value=",dur:s">Short (< 4 min)</item> - <item value=",dur:m">Medium (4-20 min)</item> - <item value=",dur:l">Long (> 20 min)</item> - </itemlist> - <button> <label>Search</label> - <submission>wvt:///video.google.com/searchresults.xsl?srcurl=<xsl:value-of select="str:encode-uri('http://www.google.com/search?q={q}&tbs=vid:1{dur}{so}', true())"/>&HTTP-header=User-Agent,Mozilla/5.0</submission> + <submission>wvt:///video.google.com/searchresults.xsl?srcurl=<xsl:value-of select="str:encode-uri('http://video.google.com/videosearch?q={q}+site:video.google.com&start=0&hl=en', true())"/>&HTTP-header=User-Agent,Mozilla/5.0%20(X11;%20Linux%20x86_64;%20rv:5.0.1)%20Gecko/20100101%20Firefox/5.0.1</submission> </button> </wvmenu> </xsl:template> diff --git a/templates/video.google.com/searchresults.xsl b/templates/video.google.com/searchresults.xsl index a65b8a6..28230c0 100644 --- a/templates/video.google.com/searchresults.xsl +++ b/templates/video.google.com/searchresults.xsl @@ -4,12 +4,19 @@ xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:str="http://exslt.org/strings"> +<xsl:template match="a"> + <link> + <label><xsl:value-of select="."/></label> + <stream>wvt:///video.google.com/videopage.xsl?srcurl=<xsl:value-of select="str:encode-uri(@href, true())"/></stream> + </link> +</xsl:template> + <xsl:template match="/"> <wvmenu> <title>Search results</title> <xsl:choose> - <xsl:when test="not(//li[contains(@class, 'g')]//td/a[not(img)])"> + <xsl:when test="not(//a[starts-with(@href, 'http://video.google.com/videoplay?')])"> <textarea> <label> <xsl:text>Your search did not return any results.</xsl:text> @@ -18,43 +25,7 @@ </xsl:when> <xsl:otherwise> - <xsl:for-each select="//li[@class='g']//td/a[not(img)]"> - <xsl:variable name="url" select="str:decode-uri(substring-after(@href, 'q='))" /> - - <xsl:choose> - <xsl:when test="starts-with($url, 'http://www.youtube.com/')"> - <link> - <label><xsl:value-of select="normalize-space(.)" /></label> - <stream>wvt:///www.youtube.com/videopage.xsl?srcurl=<xsl:value-of select="str:encode-uri($url, true())"/></stream> - <ref>wvt:///www.youtube.com/description.xsl?srcurl=<xsl:value-of select="str:encode-uri(concat('http://gdata.youtube.com/feeds/api/videos/', substring-after($url, 'v='), '?v=2'), true())"/></ref> - </link> - </xsl:when> - - <xsl:when test="starts-with($url, 'http://video.google.com/')"> - <link> - <label><xsl:value-of select="normalize-space(.)"/></label> - <stream>wvt:///video.google.com/videopage.xsl?srcurl=<xsl:value-of select="str:encode-uri($url, true())"/></stream> - <ref>wvt:///video.google.com/description.xsl?srcurl=<xsl:value-of select="str:encode-uri($url, true())"/></ref> - </link> - </xsl:when> - - <xsl:when test="starts-with($url, 'http://www.metacafe.com/')"> - <link> - <label><xsl:value-of select="normalize-space(.)"/></label> - <stream>wvt:///www.metacafe.com/videopage.xsl?srcurl=<xsl:value-of select="str:encode-uri($url, true())"/></stream> - <ref>wvt:///www.metacafe.com/description.xsl?srcurl=<xsl:value-of select="str:encode-uri($url, true())"/></ref> - </link> - </xsl:when> - - </xsl:choose> - </xsl:for-each> - - <xsl:for-each select="id('nav')//td[@class='b']/a"> - <link> - <label><xsl:value-of select="span[2]/text()"/></label> - <ref>wvt:///video.google.com/searchresults.xsl?srcurl=<xsl:value-of select="str:encode-uri(@href, true())"/></ref> - </link> - </xsl:for-each> + <xsl:apply-templates select="//a[starts-with(@href, 'http://video.google.com/videoplay?')]"/> </xsl:otherwise> </xsl:choose> diff --git a/templates/video.google.com/videopage.xsl b/templates/video.google.com/videopage.xsl index 52d6d98..802fc1b 100644 --- a/templates/video.google.com/videopage.xsl +++ b/templates/video.google.com/videopage.xsl @@ -4,15 +4,22 @@ xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:str="http://exslt.org/strings"> +<xsl:template match="script"> + <xsl:variable name="videourl"> + <xsl:value-of select="str:decode-uri(substring-before(substring-after(., 'videoUrl\x3d'), '\x26'))"/> + </xsl:variable> + + <xsl:if test="$videourl"> + <url> + <xsl:value-of select="$videourl"/> + </url> + </xsl:if> +</xsl:template> + <xsl:template match="/"> <mediaurl> <title><xsl:value-of select="/html/head/title" /></title> - <xsl:for-each select="/html/body/script"> - <xsl:variable name="videourl" select="str:decode-uri(substring-before(substring-after(., 'videoUrl\x3d'), '\x26'))"/> - <xsl:if test="$videourl"> - <url><xsl:value-of select="$videourl"/></url> - </xsl:if> - </xsl:for-each> + <xsl:apply-templates select="//script[contains(., 'videoUrl\x3d')]"/> </mediaurl> </xsl:template> |