summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2014-01-11 16:36:30 +0100
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2014-01-11 18:32:43 +0100
commitb7e1eeb8289e8519b1d4d452978dbe4915ef10d2 (patch)
tree73db77556ca2c06379de915d8422573e0944073b
parentc15923c4bfd0f84661a2f6d1bfa6c7185b852915 (diff)
downloaddotfiles-b7e1eeb8289e8519b1d4d452978dbe4915ef10d2.tar.gz
dotfiles-b7e1eeb8289e8519b1d4d452978dbe4915ef10d2.tar.bz2
dotfiles-b7e1eeb8289e8519b1d4d452978dbe4915ef10d2.zip
quvi: Add script for zdfmediathek
For now the script does only output the veryhigh quality mp4 url. This format features h264 and aac encoding, so vaapi can be used to accelerate.
-rw-r--r--.local/share/libquvi-scripts/lua/website/zdfmediathek.lua47
1 files changed, 47 insertions, 0 deletions
diff --git a/.local/share/libquvi-scripts/lua/website/zdfmediathek.lua b/.local/share/libquvi-scripts/lua/website/zdfmediathek.lua
new file mode 100644
index 0000000..3499323
--- /dev/null
+++ b/.local/share/libquvi-scripts/lua/website/zdfmediathek.lua
@@ -0,0 +1,47 @@
+-- Identify the script.
+function ident(self)
+ package.path = self.script_dir .. '/?.lua'
+ local C = require 'quvi/const'
+ local r = {}
+ r.domain = "zdf%.de"
+ r.formats = "default|best"
+ r.categories = C.proto_rtmp
+ local U = require 'quvi/util'
+ r.handles = U.handles(self.page_url, {r.domain},
+ {"/ZDFmediathek/beitrag/video/"})
+ return r
+end
+
+-- Query available formats.
+function query_formats(self)
+ self.formats = "default|best"
+
+ return self
+end
+
+-- Parse media URL.
+function parse(self)
+ self.host_id = "zdfmediathek"
+
+ self.id = self.page_url:match("/ZDFmediathek/beitrag/video/(%d+)")
+ or error ("no match: media id")
+
+ local xmlwebservice_url = "http://www.zdf.de/ZDFmediathek/xmlservice/web/beitragsDetails?id=" .. self.id
+
+ local c = quvi.fetch(xmlwebservice_url, {fetch_type='config'})
+ if c:match('<error>') then
+ local s = c:match('<message>(.-)[\n<]')
+ error( (not s) and "no match: error message" or s )
+ end
+
+ self.title = c:match('<title>([^<]*)</title>')
+ or error("no match: media title")
+
+ self.thumbnail_url = c:match('<teaserimage alt="[^"]*" key="946x532">([^<]*)</teaserimage>')
+
+ self.url = { c:match('<quality>veryhigh</quality>[ \n]*<url>(http://nrodl.zdf.de/[^<]*\.mp4)</url>') }
+
+ return self
+end
+
+-- vim: set ts=4 sw=4 tw=72 expandtab: