mirror of
https://gitlab.com/moepoi/HanimeTV.git
synced 2024-11-14 02:56:16 +01:00
Added login
This commit is contained in:
parent
2798a36217
commit
af8881bf0a
1 changed files with 21 additions and 17 deletions
|
@ -17,6 +17,14 @@ class HanimeTV:
|
||||||
if email is None and password is None:
|
if email is None and password is None:
|
||||||
self.session = ''
|
self.session = ''
|
||||||
else:
|
else:
|
||||||
|
try:
|
||||||
|
login = self.login(email, password)
|
||||||
|
self.session = login["session_token"]
|
||||||
|
except:
|
||||||
|
print ("Invalid Credential")
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
def login(self, email, password):
|
||||||
url = "{}/api/v3/sessions".format(self.host)
|
url = "{}/api/v3/sessions".format(self.host)
|
||||||
headers = {
|
headers = {
|
||||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:65.0) Gecko/20100101 Firefox/65.0',
|
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:65.0) Gecko/20100101 Firefox/65.0',
|
||||||
|
@ -33,11 +41,7 @@ class HanimeTV:
|
||||||
"password": str(password)
|
"password": str(password)
|
||||||
}
|
}
|
||||||
req = requests.post(url, headers=headers, json=data)
|
req = requests.post(url, headers=headers, json=data)
|
||||||
try:
|
return json.loads(req.text)
|
||||||
self.session = json.loads(req.text)["session_token"]
|
|
||||||
except:
|
|
||||||
print ("Invalid Credential")
|
|
||||||
sys.exit()
|
|
||||||
|
|
||||||
def search(self, query):
|
def search(self, query):
|
||||||
url = "https://thorin-us-east-1.searchly.com/hentai_videos/hentai_video/_search?from=0&size=48"
|
url = "https://thorin-us-east-1.searchly.com/hentai_videos/hentai_video/_search?from=0&size=48"
|
||||||
|
|
Loading…
Reference in a new issue