blob: dd80df692d91ace3915b8b727afb582a3a60ae91 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
-- libquvi-scripts
local Putlocker = {}
-- Identify the script.
function ident(qargs)
return {
domains = table.concat({'putlocker.com', 'sockshare.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('<div class="site-content">[^<]+<h1>(.-)<strong>')
qargs.streams = Putlocker.iter_streams(c, qargs)
return qargs
end
function Putlocker.iter_streams(c, qargs)
local S = require 'quvi/stream'
url = c:match('<a href="([^"]+)" class="download_file_link"')
local U = require 'socket.url'
local t = U.parse(qargs.input_url)
local s = S.stream_new(table.concat({"http://", t.host, url}))
return { s }
end
function Putlocker.can_parse_url(qargs)
local U = require 'socket.url'
local t = U.parse(qargs.input_url)
return t and t.scheme and t.scheme:lower():match('^http$')
and t.host and (t.host:lower():match('putlocker%.com$') or
t.host:lower():match('sockshare%.com$'))
and t.path and t.path:match("^/file/[A-Z0-9]+")
and true or false
end
-- vim: set ts=2 sw=2 tw=72 expandtab:
|