-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
psbdmp.ads
51 lines (40 loc) · 1.12 KB
/
psbdmp.ads
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
-- Copyright 2022 Jeff Foley. All rights reserved.
-- Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
local json = require("json")
name = "PSBDMP"
type = "api"
function start()
set_rate_limit(1)
end
function vertical(ctx, domain)
local c
local cfg = datasrc_config()
if cfg ~= nil then
c = cfg.credentials
end
local resp, err = request(ctx, {url=search_url(domain)})
if (err ~= nil and err ~= "") then
log(ctx, "vertical request to service failed: " .. err)
return
end
send_names(ctx, resp)
if (c == nil or c.key == nil or c.key == "") then
return
end
local j = json.decode(resp)
if (j == nil or j.count == nil or j.count == 0) then
return
end
for _, dump in pairs(j.data) do
local ok = scrape(ctx, {url=dump_url(dump.id, c.key)})
if not ok then
return
end
end
end
function search_url(domain)
return "https://psbdmp.ws/api/v3/search/" .. domain
end
function dump_url(id, key)
return "https://psbdmp.ws/api/v3/dump/" .. id .. "?key=" .. key
end