From 8abf288264d0119eb85009fb77c055088aef038f Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Fri, 7 Feb 2014 18:07:58 +0100 Subject: quvi 0.9: Add script for putlocker --- .local/share/libquvi-scripts/media/putlocker.lua | 51 ++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .local/share/libquvi-scripts/media/putlocker.lua diff --git a/.local/share/libquvi-scripts/media/putlocker.lua b/.local/share/libquvi-scripts/media/putlocker.lua new file mode 100644 index 0000000..f3abebc --- /dev/null +++ b/.local/share/libquvi-scripts/media/putlocker.lua @@ -0,0 +1,51 @@ +-- libquvi-scripts + +local Putlocker = {} + +-- Identify the script. +function ident(qargs) + return { + domains = table.concat({'putlocker.com'}, ','), + can_parse_url = Putlocker.can_parse_url(qargs) + } +end + +-- Parse media URL. +function parse(qargs) + local R = require 'soup_request' + local c = quvi.http.fetch(qargs.input_url).data + local p = { confirm = "Continue as Free User", + hash = c:match('value="([^"]+)" name="hash"') } + c = R.request(qargs.input_url, "POST", p) + + qargs.id = qargs.input_url:match("file/([A-Z0-9]+)") + qargs.title = c:match('
%s*

(.-)') + --qargs.thumb_url = c:match('property="og:image"%s+content="(.-)"') + --qargs.duration_ms = tonumber(c:match('duration:%s*"(%d+)"') or 0) * 1000 + qargs.streams = Putlocker.iter_streams(c, qargs) + + return qargs +end + +function Putlocker.iter_streams(c, qargs) + local S = require 'quvi/stream' + + url = c:match('