1 | """ |
---|
2 | Plugin for UrlResolver |
---|
3 | Copyright (C) 2021 gujal |
---|
4 | This program is free software: you can redistribute it and/or modify |
---|
5 | it under the terms of the GNU General Public License as published by |
---|
6 | the Free Software Foundation, either version 3 of the License, or |
---|
7 | (at your option) any later version. |
---|
8 | This program is distributed in the hope that it will be useful, |
---|
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
11 | GNU General Public License for more details. |
---|
12 | You should have received a copy of the GNU General Public License |
---|
13 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
14 | """ |
---|
15 | |
---|
16 | #import re |
---|
17 | #from urlresolver.plugins.lib import helpers |
---|
18 | #from urlresolver import common |
---|
19 | #from urlresolver.resolver import UrlResolver, ResolverError |
---|
20 | |
---|
21 | import re |
---|
22 | import sys |
---|
23 | import time |
---|
24 | from lib.net import Net |
---|
25 | import re, urllib, json |
---|
26 | from lib import helpers |
---|
27 | import lib.common as common |
---|
28 | |
---|
29 | class EvoLoadResolver(object): |
---|
30 | name = "evoload" |
---|
31 | domains = ["evoload.io"] |
---|
32 | pattern = r'(?://|\.)(evoload\.io)/(?:e|f|v)/([0-9a-zA-Z]+)' |
---|
33 | |
---|
34 | # def __init__(self): |
---|
35 | # self.net = common.Net() |
---|
36 | |
---|
37 | def __init__(self): |
---|
38 | self.net = Net() |
---|
39 | url = str(sys.argv[1]) |
---|
40 | host = self.get_host_and_id(url)[0] |
---|
41 | media_id = self.get_host_and_id(url)[1] |
---|
42 | |
---|
43 | return self.get_media_url(host, media_id) |
---|
44 | |
---|
45 | def get_host_and_id(self, url): |
---|
46 | r = re.search(self.pattern, url, re.I) |
---|
47 | if r: |
---|
48 | return r.groups() |
---|
49 | else: |
---|
50 | return False |
---|
51 | |
---|
52 | def get_media_url(self, host, media_id): |
---|
53 | surl = 'https://evoload.io/SecurePlayer' |
---|
54 | web_url = self.get_url(host, media_id) |
---|
55 | rurl = 'https://{0}/'.format(host) |
---|
56 | headers = {'User-Agent': common.FF_USER_AGENT, |
---|
57 | 'Referer': rurl} |
---|
58 | html = self.net.http_GET(web_url, headers).content |
---|
59 | passe = re.search('<div id="captcha_pass" value="(.+?)"></div>', html).group(1) |
---|
60 | headers.update({'Origin': rurl[:-1]}) |
---|
61 | crsv = self.net.http_GET('https://csrv.evosrv.com/captcha?m412548', headers).content |
---|
62 | post = {"code": media_id, "csrv_token": crsv, "pass": passe, "token": "ok"} |
---|
63 | shtml = self.net.http_POST(surl, form_data=post, headers=headers, jdata=True).content |
---|
64 | r = json.loads(shtml).get('stream') |
---|
65 | if r: |
---|
66 | surl = r.get('backup') if r.get('backup') else r.get('src') |
---|
67 | if surl: |
---|
68 | print surl + helpers.append_headers(headers) |
---|
69 | else: |
---|
70 | print 'errormsg=File1 Not Found or removed' |
---|
71 | |
---|
72 | else: |
---|
73 | print 'errormsg=File Not Found or removed' |
---|
74 | |
---|
75 | def get_url(self, host, media_id): |
---|
76 | return 'https://%s/e/%s.html' % (host, media_id) |
---|
77 | |
---|
78 | sys.stdout = EvoLoadResolver() |
---|