test
This commit is contained in:
parent
f0138a9b61
commit
2fda2f58b0
@ -1,3 +1,7 @@
|
||||
import json
|
||||
import re
|
||||
|
||||
import fHDHR.exceptions
|
||||
|
||||
|
||||
class OriginService():
|
||||
@ -5,6 +9,28 @@ class OriginService():
|
||||
def __init__(self, fhdhr):
|
||||
self.fhdhr = fhdhr
|
||||
|
||||
self.base_url = 'http://www.xumo.tv'
|
||||
|
||||
self.login()
|
||||
|
||||
def login(self):
|
||||
self.fhdhr.logger.info("Fetching XUMO token")
|
||||
self.geoID, self.geoLST = self.getID()
|
||||
if not self.geoID or self.geoLST:
|
||||
raise fHDHR.exceptions.OriginSetupError("XUMO Setup Failed")
|
||||
else:
|
||||
self.fhdhr.logger.info("XUMO Setup Success")
|
||||
self.status_dict["Login"] = "Success"
|
||||
self.fhdhr.config.write(self.fhdhr.config.dict["main"]["dictpopname"], 'token', self.token)
|
||||
return True
|
||||
|
||||
def getID(self):
|
||||
pagereq = self.fhdhr.web.session.get(self.base_url)
|
||||
results = json.loads(re.findall('__JOBS_REHYDRATE_STATE__=(.+?);</script>', (pagereq), flags=re.DOTALL)[0])
|
||||
print(results["jobs"]["1"]["data"]["geoId"])
|
||||
print(results["jobs"]["1"]["data"]["channelListId"])
|
||||
return results["jobs"]["1"]["data"]["geoId"], results["jobs"]["1"]["data"]["channelListId"]
|
||||
|
||||
def get_status_dict(self):
|
||||
ret_status_dict = {
|
||||
"Login": "Success",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user