-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopenload.py
36 lines (25 loc) · 1010 Bytes
/
openload.py
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
# -*- coding: utf-8 -*-
import httplib2
import json
import xbmcaddon
from config_default import configs
cache = xbmcaddon.Addon(id='plugin.video.mv6park').getAddonInfo('path') + '/.cache'
#httplib2.debuglevel = 1
h = httplib2.Http(cache, disable_ssl_certificate_validation=True)
def get_dl_ticket(file, login, key):
url = 'https://api.openload.co/1/file/dlticket?file=%s&login=%s&key=%s' % (file, login, key)
response, content = h.request(url, 'GET')
contect = json.loads(content)
ticket = ''
if (contect.get('status') == 200):
ticket = contect.get('result').get('ticket')
return ticket
def get_dl_link(file):
ticket = get_dl_ticket(file, configs.get('login'), configs.get('key'))
url = 'https://api.openload.co/1/file/dl?file=%s&ticket=%s' % (file, ticket)
response, content = h.request(url, 'GET')
contect = json.loads(content)
link = ''
if (contect.get('status') == 200):
link = contect.get('result').get('url')
return link