mirror of
https://gitlab.com/moepoi/HanimeTV.git
synced 2024-11-12 18:16:17 +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:
|
||||
self.session = ''
|
||||
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)
|
||||
headers = {
|
||||
'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)
|
||||
}
|
||||
req = requests.post(url, headers=headers, json=data)
|
||||
try:
|
||||
self.session = json.loads(req.text)["session_token"]
|
||||
except:
|
||||
print ("Invalid Credential")
|
||||
sys.exit()
|
||||
return json.loads(req.text)
|
||||
|
||||
def search(self, query):
|
||||
url = "https://thorin-us-east-1.searchly.com/hentai_videos/hentai_video/_search?from=0&size=48"
|
||||
|
|
Loading…
Reference in a new issue