-
Notifications
You must be signed in to change notification settings - Fork 0
/
yts_class.py
44 lines (33 loc) · 987 Bytes
/
yts_class.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
36
37
38
39
40
41
42
43
44
import requests
import six
class RawYTS:
def __init__(self):
pass
def raw_upcoming(self):
url = 'https://yts.re/api/upcoming.json'
res = requests.get(url)
dic = res.json()
return dic
def raw_torrents(self,limit=20,page=1,quality='ALL',rating=0,genre='ALL',sort='date'):
url = 'https://yts.re/api/list.json'
payload = {'limit':limit,'set':page,'quality':quality,'rating':rating,'genre':genre,'sort':sort}
res = requests.get(url,params=payload)
dic = res.json()
return dic
def raw_latest(self):
url = 'https://yts.re/api/list.json'
res = requests.get(url)
dic = res.json()
return dic
def raw_search(self,movie):
url = 'https://yts.re/api/list.json'
res = requests.get(url,params={'keywords':movie})
dic = res.json()
return dic
def raw_requests_confirmed(self):
url = 'https://yts.re/api/requests.json'
res = requests.get(url,params={'page':'confirmed'})
dic = res.json()
return dic
test = RawYTS()
print test.raw_torrents()