def getLikedPosts(self, pagenum=0): apiurlfav = 'search_User_Posts_Favorite' apiurllike = 'search_User_Posts_Like' reqdata = 'json={"Params":["[{IPADDRESS}]","' + self.userToken + '",null,"474518682472378200",652167258595817300,' reqdatalike = reqdata + str(self.UserId) + ',null,null,0,' + str( self.maxResults) + ',' + str( pagenum) + ',null,0,"",1,5,7,0,0,null,null]}' litems = [] dashitems = [] postitems = [] tags = [] likelist = [] favlist = [] apiurl = self.BASEURL + apiurlfav resp = urlquick.post(url=apiurl, data=reqdatalike, headers=self.headerdict) likeresult = resp.json().get('aResultSet', []) apiurl = self.BASEURL + apiurllike resp = urlquick.post(url=apiurl, data=reqdatalike, headers=self.headerdict) faveresult = resp.json().get('aResultSet', []) self.aResultSet = likeresult if len(likeresult) > 1: likelist = likeresult[3].get('aRow', []) if len(faveresult) > 1: favlist = faveresult[3].get('aRow', []) for post in favlist: postitems.append(self.makePost(post, faveresult)) for post in likelist: postitems.append(self.makePost(post, likeresult)) for item in postitems: litems.append(self.makePostItem(post=item)) return litems
def getBlogDetails(self, blogid=0): blogdict = {} apiurlblog = self.BASEURL + "get_Blog_Marquee" blogresult = [] blogreqdata = 'json={"Params":["[{IPADDRESS}]","' + self.userToken + '",null,"474518682472378200",652167258595817300,' + str( self.userIx) + ',' + str(blogid) + ']}' resp = urlquick.post(url=apiurlblog, data=blogreqdata, headers=self.headerdict) #resp = urlquick.request(method="POST", url=apiurlblog, data=blogreqdata, headers=self.headerdict) if not resp.ok: resp = urlquick.post(url=apiurlblog, data=blogreqdata, headers=self.headerdict) if not resp.ok: resp = urlquick.post(url=apiurlblog, data=blogreqdata, headers=self.headerdict) if resp.ok: blogresult = resp.json().get('aResultSet', []) if len(blogresult) > 2: detresults = blogresult[2].get('aRow', []) if len(detresults) > 0: blogdict = detresults[0] ablog = newTumbl.Blog(**blogdict) return ablog else: return []
def authenticate(): TOKEN = getToken("LOGIN") #encrypt the password ENCRYPTED_PASSWORD = encryptPASS() # build payload EMAIL = Script.setting.get_string('username') LOGIN_PAYLOAD = { "email": EMAIL, "password": ENCRYPTED_PASSWORD, "deviceType": "Mobile", "physicalDeviceType": "IOS", "isNewUser": False, "captchaToken": "c2hhaGlkLWF1dGgta2V5LXRva2Vu" } LOGIN_HEADERS = { 'UUID': 'web', 'Content-Type': 'application/json', 'User-Agent': SHAHID_AGENT, 'S-Session': TOKEN } LOGIN_DATA = urlquick.post(LOGIN_URL, json=LOGIN_PAYLOAD, headers=LOGIN_HEADERS, max_age=604800).json() LOGIN_INFO = { 'TOKEN': LOGIN_DATA['user']['token'], 'EXT_TOKEN': LOGIN_DATA['user']['externalToken'], 'SESSION_ID': LOGIN_DATA['user']['sessionId'], 'EXT_SESSION_ID': LOGIN_DATA['user']['externalSessionId'], 'EXT_USER_ID': LOGIN_DATA['user']['externalUserId'], 'HTTP_SESSION_ID': LOGIN_DATA['user']['httpSessionId'] } return LOGIN_INFO
def getDashPosts(self, page=0, tag=""): litems = [] dashresult = [] tags = [] postitems = [] dashlist = [] apiurl = self.BASEURL + "search_Dash_Posts" if page > 0: if page < 99: page = page * 100 if tag is not "": tag = "#{0}".format(tag) reqdata = 'json={"Params":["[{IPADDRESS}]","' + self.userToken + '",null,"474518682472378200",652167258595817300,' reqdatalike = reqdata + str(self.UserId) + ',null,null,0,' + str( self.maxResults) + ',' + str( page) + ',null,0,"{0}",1,5,7,0,0,null,null]'.format(tag) + '}' resp = urlquick.post(url=apiurl, data=reqdatalike, headers=self.headerdict) dashresult = resp.json().get('aResultSet', []) self.aResultSet = dashresult if len(dashresult) > 1: dashlist = dashresult[3].get('aRow', []) for post in dashlist: postitems.append(self.makePost(post, dashresult)) for item in postitems: litems.append(self.makePostItem(post=item)) return litems '''
def play(plugin, channel_id, showtime=None, srno=None): with open(EXTRA_CHANNELS, "r") as f: extra = json.load(f) if showtime is None and extra.get(str(channel_id)): if extra.get(str(channel_id)).get("ext"): return extra.get(str(channel_id)).get("ext") return PLAY_EX_URL + extra.get(str(channel_id)).get("data") rjson = {"channel_id": int(channel_id), "stream_type": "Seek"} if showtime and srno: rjson["showtime"] = showtime rjson["srno"] = srno rjson["stream_type"] = "Catchup" resp = urlquick.post(GET_CHANNEL_URL, json=rjson).json() return Listitem().from_dict( **{ "label": plugin._title, "callback": resp.get("result", "") + "?" + urlencode(getTokenParams()), "properties": { "IsPlayable": True, "inputstream": "inputstream.adaptive", "inputstream.adaptive.stream_headers": "User-Agent=KAIOS", "inputstream.adaptive.manifest_type": "hls", "inputstream.adaptive.license_key": urlencode(getTokenParams()) + "|" + urlencode(getHeaders()) + "|R{SSM}|", } })
def SearchForBlog(self, keyword="", pagenum=0): # blog icon format: https://dn0.newtumbl.com/img/163769/0/0/4545774/nT_5huakyb46vui0z09rin7ptgi_150.jpg # https://dn0.newtumbl.com/img/{blogid}/0/0/{qwMediaIx_Icon}/nT_{Base32(Sha256(path))}.jpg # Blogs List aResultSet[0][2]['aRow'] # Blog Icons aResultSet[0][1]['aRow'] # curl 'https://api-ro.newtumbl.com/sp/NewTumbl/search_Site_Blogs' -H 'Accept: */*' -H 'Referer: https://newtumbl.com/search' -H 'DNT: 1' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36' -H 'Sec-Fetch-Mode: cors' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' --data 'json=%7B%22Params%22%3A%5B%22%5B%7BIPADDRESS%7D%5D%22%2C%22FzCWMJIw6mi8gl6pU6LgpGMcncAg75JIqnqBsiGK2tytG76I%22%2C391932%2Cnull%2Cnull%2C0%2C25%2C0%2C%22public%22%2C0%2C0%5D%7D' --compressed litems = [] litem = {} headers = self.headerdict headers.update({'Referer': 'https://newwtumbl.com/search'}) reqdata = 'json={"Params":["[{IPADDRESS}]","' + self.userToken + '",null,"474518682472378200",652167258595817300,' + str( self.userIx) + ',null,null,0,25,' + str( pagenum) + ',"' + keyword + '",0,0]}' apiurl = self.BASEURL + "search_Site_Blogs" resp = urlquick.post(url=apiurl, data=reqdata, headers=headers) try: aResultSet = resp.json() except: aResultSet = {} results = aResultSet.get('aResultSet', []) self.aResultSet = results if len(results) > 0: blogs = results[2]['aRow'] for blog in blogs: litems.append(self.makeBlogItem(blog)) return litems
def list_videos_courses(plugin, item_id, category_url, page, **kwargs): params = {'range': '[%s,%s]' % (page, str(int(page) + 11))} resp = urlquick.post(category_url, params=params) json_parser = json.loads(resp.text) for video_datas in json_parser["results"]: video_title = 'R%s - C%s - %s' % ( video_datas["reunion"]["num_reunion"], video_datas["num_course_pmu"], video_datas["libcourt_prix_course"]) video_image = URL_IMAGE % video_datas["photo"]["slug"] video_url = URL_ROOT + '/courses/%s/R%s/C%s' % ( video_datas["reunion"]["date_reunion"], video_datas["reunion"] ["num_reunion"], video_datas["num_course_pmu"]) item = Listitem() item.label = video_title item.art['thumb'] = item.art['landscape'] = video_image item.set_callback(get_video_course_url, item_id=item_id, video_url=video_url) item_post_treatment(item, is_playable=True, is_downloadable=True) yield item # More videos... yield Listitem.next_page(item_id=item_id, category_url=category_url, page=str(int(page) + 12))
def getBlogPosts(self, blogid=0, pagenum=0, filterby=media.VIDEO, filterdate=""): apiurl = self.BASEURL + "search_Blog_Posts" litems = [] postitems = [] ablog = None reqdata = 'json={"Params":["[{IPADDRESS}]","' + self.userToken + '",null,"474518682472378200",652167258595817300,' + str( self.userIx) + ',null,null,0,' + str(self.maxResults) + ',' + str( pagenum) + ',null,0,"",1,5,7,0,0,' + str(blogid) + ',null]}' resp = urlquick.post(url=apiurl, data=reqdata, headers=self.headerdict) results = resp.json().get('aResultSet', []) self.aResultSet = results if len(results) == 0: return [] else: items = results[3].get('aRow', []) for post in items: postitems.append(self.makePost(post, results)) for item in postitems: litems.append(self.makePostItem(post=item)) return litems '''
def LikeVid(self, vidid=0): apiurl = self.BASEURL + 'set_Like_Insert' apiurl = apiurl.replace('-ro', '-rw') reqdata = 'json={"Params":["[{IPADDRESS}]","' + self.userToken + '",null,"474518682472378200",652167258595817300,' + str( self.userIx) + ',' + str(vidid) + ']}' resp = urlquick.post(apiurl, data=reqdata, headers=self.headerdict) return resp.ok
def list_videos_emissions(plugin, item_id, category_url, page, **kwargs): params = {'range': '[%s,%s]' % (page, str(int(page) + 11))} resp = urlquick.post(category_url, params=params) json_parser = json.loads(resp.text) for video_datas in json_parser["results"]: video_title = video_datas["name"] video_image = URL_IMAGE % video_datas["episode"]["media"]["slug"] video_url = URL_ROOT + '/programmes/' + \ video_datas["program"]["slug"] + '/' + video_datas["episode"]["slug"] item = Listitem() item.label = video_title item.art['thumb'] = item.art['landscape'] = video_image item.set_callback(get_video_emission_url, item_id=item_id, video_url=video_url) item_post_treatment(item, is_playable=True, is_downloadable=True) yield item # More videos... yield Listitem.next_page(item_id=item_id, category_url=category_url, page=str(int(page) + 12))
def get_live_url(plugin, item_id, video_id, item_dict): video_id = 'L_%s' % item_id.upper() timeserver = str(urlquick.get(URL_TIME, max_age=-1).text) auth_key = '%s-%s-%s-%s-%s' % (video_id, SECRET_KEY, APP_NAME, SECRET_KEY, timeserver) auth_key = md5(auth_key).hexdigest() auth_key = auth_key + '/' + timeserver post_data = { 'appName': APP_NAME, 'method': 'getUrl', 'mediaId': video_id, 'authKey': auth_key, 'version': VERSION, 'hostingApplicationName': HOSTING_APPLICATION_NAME, 'hostingApplicationVersion': HOSTING_APPLICATION_VERSION } url_video = urlquick.post(URL_TOKEN, data=post_data, max_age=-1) url_video = json.loads(url_video.text) url_video = url_video['message'].replace('\\', '') return url_video.split('&b=')[0]
def guestToken(): resp = urlquick.post( url_constructor("/in/aadhar/v2/firetv/in/user/guest-signup"), json={ "idType": "device", "id": str(uuid4()), }).json() return deep_get(resp, "description.userIdentity")
def video(plugin, path, title, **kwargs): """Menu of the app with v1 API.""" headers = { 'User-Agent': USER_AGENT, 'Content-type': 'application/json', 'Accept': 'application/json, text/plain, */*', } url = API_CDN_ROOT + path params = { "app": "bfmrmc", "device": "browser", "token": token, "universe": "provider", } resp = urlquick.get(url, params=params, headers=headers).json() # For reuse params dict. del params["universe"] for stream in resp[0]["offers"][0]["streams"]: if stream["drm"] == "WIDEVINE": data = { "app": "bfmrmc", "device": "browser", "macAddress": "PC", "offerId": resp[0]["offers"][0]["offerId"], "token": token, } # Needed ID for the customdata. entitlementId = urlquick.post( "https://ws-backendtv.rmcbfmplay.com/gaia-core/rest/api/web/v1/replay/play", params=params, headers=headers, json=data, ).json()["entitlementId"] item = Listitem() item.label = get_selected_item_label() item.art.update(get_selected_item_art()) item.info.update(get_selected_item_info()) item.path = stream["url"] item.property[INPUTSTREAM_PROP] = "inputstream.adaptive" item.property["inputstream.adaptive.manifest_type"] = "mpd" item.property[ "inputstream.adaptive.license_type"] = "com.widevine.alpha" customdata = "description={}&deviceId=byPassARTHIUS&deviceName=Firefox-96.0----Windows&deviceType=PC&osName=Windows&osVersion=10&persistent=false&resolution=1600x900&tokenType=castoken&tokenSSO={}&entitlementId={}&type=LIVEOTT&accountId={}".format( USER_AGENT, token, entitlementId, account_id) customdata = urllib.parse.quote(customdata) item.property["inputstream.adaptive.license_key"] = ( "https://ws-backendtv.rmcbfmplay.com/asgard-drm-widevine/public/licence|User-Agent=" + USER_AGENT + "&customdata=" + customdata + "&Origin=https://www.rmcbfmplay.com&Content-Type=" + "|R{SSM}|") return item
def getToken(USE_CASE): if USE_CASE == 'LOGIN': URL = LOGIN_TOKEN_URL else: URL = SESSION_TOKEN_URL HEADERS = {'User-Agent': USER_AGENT, 'Shahid-Agent': SHAHID_AGENT} TOKEN = urlquick.post(URL, json={}, headers=HEADERS, max_age=-1).json()['jwt'] return TOKEN
def doLogin(self): with PersistentDict("userdata.pickle") as db: try: username = Settings.get_string( "username", "plugin.video.jiotv") or db.get("username") or Dialog( ).input("Username (MobileNo / Email)") password = Settings.get_string( "password", "plugin.video.jiotv") or db.get( "password") or Dialog().input("Password") except RuntimeError: username = Dialog().input("Username (MobileNo / Email)") password = Dialog().input("Password") if username and password: body = { "identifier": username if '@' in username else "+91" + username, "password": password, "rememberUser": "******", "upgradeAuth": "Y", "returnSessionDetails": "T", "deviceInfo": { "consumptionDeviceName": "Jio", "info": { "type": "android", "platform": { "name": "vbox86p", "version": "8.0.0" }, "androidId": "6fcadeb7b4b10d77" } } } resp = urlquick.post( "https://api.jio.com/v3/dip/user/unpw/verify", json=body, headers={ "x-api-key": "l7xx75e822925f184370b2e25170c5d5820a" }, verify=False, raise_for_status=False).json() if resp.get("ssoToken"): db["data"] = resp Script.notify("Login Successful", "You have been logged in successfully") else: Script.notify( "Login Failed", "Double check you username and password and try again") else: Script.notify("Login Required", "Please login with you Jio credentials")
def post_log(data): try: response = response = urlquick.post(URL + 'documents', data=data) if 'key' in response.json(): result = URL + response.json()['key'] return True, result elif 'message' in response.json(): return False, "Unable to upload log file: " + response.json( )['message'] else: Script.log('error: %s' % response.text) return False, "Unable to upload log file" except Exception: return False, "Unable to retrieve the paste url"
def login(username, password): body = { "identifier": username if '@' in username else "+91" + username, "password": password, "rememberUser": "******", "upgradeAuth": "Y", "returnSessionDetails": "T", "deviceInfo": { "consumptionDeviceName": "Jio", "info": { "type": "android", "platform": { "name": "vbox86p", "version": "8.0.0" }, "androidId": "6fcadeb7b4b10d77" } } } resp = urlquick.post( "https://api.jio.com/v3/dip/user/unpw/verify", headers={"x-api-key": "l7xx938b6684ee9e4bbe8831a9a682b8e19f"}, json=body, verify=False) if resp.status_code == 200 and resp.json()['ssoToken']: data = resp.json() _CREDS = { "ssotoken": data['ssoToken'], "userId": data['sessionAttributes']['user']['uid'], "uniqueId": data['sessionAttributes']['user']['unique'], "crmid": data['sessionAttributes']['user']['subscriberId'] } headers = { "User-Agent": "JioTV Kodi", "os": "Kodi", "deviceId": str(uuid4()), "versionCode": "226", "devicetype": "Kodi", "srno": "200206173037", "appkey": "NzNiMDhlYzQyNjJm", "channelid": "100", "usergroup": "tvYR7NSNn7rymo3F", "lbcookie": "1" } headers.update(_CREDS) with PersistentDict("headers", ttl=432000) as db: db["headers"] = headers else: Script.notify('Login Failed', 'Invalid credentials')
def get_live_url(plugin, item_id, video_id, item_dict, **kwargs): resp = urlquick.post(URL_TOKEN_LIVE, max_age=-1) json_parser_token = json.loads(resp.text) resp2 = urlquick.get(URL_LIVE % (item_id, json_parser_token["vrtPlayerToken"]), max_age=-1) json_parser_stream_datas = json.loads(resp2.text) stream_url = '' if "code" in json_parser_stream_datas: if json_parser_stream_datas["code"] == "INVALID_LOCATION": plugin.notify('ERROR', plugin.localize(30713)) return False for stream_datas in json_parser_stream_datas["targetUrls"]: if stream_datas["type"] == "hls_aes": stream_url = stream_datas["url"] return stream_url
def add_to_my_list(plugin, itemID, profile_id, profile_type, is_master): plugin.log('add_to_my_list', lvl=plugin.DEBUG) headers = get_headers(profile_id, profile_type, is_master) add_url = ADD_TO_LIST_URL + str(itemID) plugin.log('Fetching url: %s' % add_url, lvl=plugin.DEBUG) Response = urlquick.post(add_url, headers=headers, max_age=0).json() success = Response['success'] if success: plugin.notify(plugin.localize(30208), plugin.localize(30204), display_time=5000, sound=True) else: plugin.notify(plugin.localize(30209), plugin.localize(30205), display_time=5000, sound=True)
def getVidsForTag(self, tagname="", page=0): apiurl = self.BASEURL + "search_Site_Posts" litems = [] tags = [] postitems = [] reqdata = 'json={"Params":["[{IPADDRESS}]","' + self.userToken + '",null,"474518682472378200",652167258595817300,' + str( self.userIx) + ',null,null,0,' + str(self.maxResults) + ',' + str( page) + ',null,0,"#' + tagname + '",1,5,7,0,0,null,null]}' resp = urlquick.post(url=apiurl, data=reqdata, headers=self.headerdict) #resp = urlquick.request(method="POST", url=apiurl, data=reqdata, headers=self.headerdict) results = resp.json().get('aResultSet', []) self.aResultSet = results items = results[3].get('aRow', []) for post in items: postitems.append(self.makePost(post, results)) for item in postitems: litems.append(self.makePostItem(post=item)) return litems
def sendOTP(mobile): if "+91" not in mobile: mobile = "+91" + mobile body = { "identifier": mobile, "otpIdentifier": mobile, "action": "otpbasedauthn" } Script.log(body, lvl=Script.ERROR) resp = urlquick.post( "https://api.jio.com/v3/dip/user/otp/send", json=body, headers={"x-api-key": "l7xx75e822925f184370b2e25170c5d5820a"}, max_age=-1, verify=False, raise_for_status=False) if resp.status_code != 204: return resp.json().get("errors", [{}])[-1].get("message") return None
def get_video_url(plugin, item_id, content_id, video_id, download_mode=False, **kwargs): payload = {"device_layout": "web", "device_type": "web"} resp = urlquick.post(URL_BRIGHTCOVE_DATAS % (content_id, video_id), data=payload, max_age=-1) json_parser2 = json.loads(resp.text) data_account = json_parser2["data"]["stream"]["video_provider_details"][ "account_id"] data_player = 'default' data_video_id = json_parser2["data"]["stream"]["url"] return resolver_proxy.get_brightcove_video_json(plugin, data_account, data_player, data_video_id)
def get_live_url(plugin, item_id, video_id, item_dict): if item_id == 'via93': live_html = urlquick.get( URL_LIVE_VIA93 % item_id, headers={'User-Agent': web_utils.get_random_ua}, max_age=-1) else: live_html = urlquick.get( URL_LIVE % item_id, headers={'User-Agent': web_utils.get_random_ua}, max_age=-1) live_soup = bs(live_html.text, 'html.parser') list_lives_datas = live_soup.find_all('iframe') live_id = '' for live_datas in list_lives_datas: src_datas = live_datas.get('src') break if 'dailymotion' in src_datas: live_id = re.compile( r'dailymotion.com/embed/video/(.*?)[\?\"]').findall(src_datas)[0] return resolver_proxy.get_stream_dailymotion(plugin, live_id, False) elif 'infomaniak' in src_datas: player_id = src_datas.split('player=')[1] resp2 = urlquick.get(URL_STREAM_INFOMANIAK % player_id, headers={'User-Agent': web_utils.get_random_ua}, max_age=-1) json_parser = json.loads(resp2.text) return 'https://' + json_parser["sPlaylist"] else: live_id = re.compile(r'v=(.*?)\&').findall(src_datas)[0] stream_json = urlquick.post( URL_STREAM, data={ 'action': 'video_info', 'refvideo': live_id }, headers={'User-Agent': web_utils.get_random_ua}, max_age=-1) stream_jsonparser = json.loads(stream_json.text) return stream_jsonparser["data"]["bitrates"]["hls"]
def getFollowedBlogs(self): apiurl = self.BASEURL + 'search_User_Blogs_Follow' litems = [] headers = self.headerdict headers.update({'Referer': 'https://newwtumbl.com/follow-hide'}) reqdata = 'json={"Params":["[{IPADDRESS}]","' + self.userToken + '",null,"474518682472378200",652167258595817300,' + str( self.userIx) + ',null,null,0,25,0,null,1]}' resp = urlquick.post(url=apiurl, data=reqdata, headers=headers) try: aResultSet = resp.json() except: aResultSet = {} if aResultSet.get('aResultSet', []): results = aResultSet.get('aResultSet', []) self.aResultSet = results if len(results) > 0: blogs = results[2]['aRow'] for blog in blogs: litems.append(self.makeBlogItem(blog)) return litems
def getLiveUrl(Id): headers, body = JioAPI._getPlayHeaders() body["id"] = str(Id) body["deviceType"] = "tv" resp = urlquick.post(url_constructor( "/apis/2ccce09e59153fc9/v1/plus-playbackrights/get/%s" % Id), headers=headers, json=body, max_age=-1, raise_for_status=False) Script.log("response %s" % resp.text, lvl=Script.INFO) if resp.status_code == 200 and resp.json().get("code") == 200: resp = resp.json() playbackUrl = deep_get(resp, "mpd.auto") licenseUrl = resp.get("keyUrl") params = "jct=%s&pxe=%s&st=%s" % (resp.get("jct"), resp.get("pxe"), resp.get("st")) Script.log(playbackUrl, lvl=Script.INFO) Script.log(licenseUrl, lvl=Script.INFO) if playbackUrl and licenseUrl: return playbackUrl + "?%s" % params, licenseUrl + "&%s" % params return None, None
def get_live_url(plugin, item_id, **kwargs): unix_time = time.time() resp = urlquick.get(URL_LIVE_DATAS % unix_time) json_parser = json.loads(resp.text) content_id = json_parser["data"]["blocks"][0]["widgets"][0]["playlist"][ "contents"][0]["id"] stream_id = json_parser["data"]["blocks"][0]["widgets"][0]["playlist"][ "contents"][0]["streams"][0]["id"] # Build PAYLOAD payload = {"device_layout": "web", "device_type": "web"} resp2 = urlquick.post(URL_BRIGHTCOVE_DATAS % (content_id, stream_id), data=payload) json_parser2 = json.loads(resp2.text) data_account = json_parser2["data"]["stream"]["video_provider_details"][ "account_id"] data_player = 'default' data_live_id = json_parser2["data"]["stream"]["url"] return resolver_proxy.get_brightcove_video_json(plugin, data_account, data_player, data_live_id)
def getFollowedTags(self): apiurl = self.BASEURL + 'search_User_Tags_Follow' litems = [] aResultSet = {} headers = self.headerdict headers.update({'Referer': 'https://newwtumbl.com/follow-hide'}) reqdata = 'json={"Params":["[{IPADDRESS}]","' + self.userToken + '",null,"474518682472378200",652167258595817300,' + str( self.userIx) + ',null,null,0,100,0,null,1]}' resp = urlquick.post(url=apiurl, data=reqdata, headers=headers) try: aResultSet = resp.json() except: aResultSet = {} results = aResultSet.get('aResultSet', []) self.aResultSet = results if len(results) > 0: tags = results[8].get('aRow', []) for tag in tags: tagcat = tag.get('szCateogry', "") if tagcat is None: tagcat = "" tagname = tag.get('szTagId_Dst', tag.get('szTag_Dst', tag.get('szTagId', ''))) tagnameonly = tagname if len(tagcat) > 1: tagname += " ({0})".format(tagcat) tagid = str(tag.get('dwTagIx_Dst', tag.get('dwTagIx', ''))) if len(tagname) < 4: tagname += " #" + tagid tagitem = { 'label': tagname.title(), 'label2': tagid, 'url': tagnameonly, 'is_folder': True, 'is_playable': False } litems.append(tagitem) return litems
def get_live_url(plugin, item_id, video_id, **kwargs): if item_id == 'fun_radio' or \ item_id == 'rtl2' or \ item_id == 'mb': if item_id == 'mb': video_json = urlquick.get( URL_LIVE_JSON % (item_id.upper()), headers={'User-Agent': web_utils.get_random_ua()}, max_age=-1) json_parser = json.loads(video_json.text) video_assets = json_parser[item_id.upper()][0]['live']['assets'] else: video_json = urlquick.get( URL_LIVE_JSON % (item_id), headers={'User-Agent': web_utils.get_random_ua()}, max_age=-1) json_parser = json.loads(video_json.text) video_assets = json_parser[item_id][0]['live']['assets'] if not video_assets: plugin.notify('INFO', plugin.localize(30716)) return False subtitle_url = '' if plugin.setting.get_boolean('active_subtitle'): for asset in video_assets: if 'subtitle_vtt' in asset["type"]: subtitle_url = asset['full_physical_path'] for asset in video_assets: if 'delta_hls_h264' in asset["type"]: item = Listitem() item.path = asset['full_physical_path'] if 'http' in subtitle_url: item.subtitles.append(subtitle_url) item.label = get_selected_item_label() item.art.update(get_selected_item_art()) item.info.update(get_selected_item_info()) return item return False else: if get_kodi_version() < 18: xbmcgui.Dialog().ok('Info', plugin.localize(30602)) return False resp_js_id = urlquick.get(URL_GET_JS_ID_API_KEY) js_id = re.compile(r'client\-(.*?)\.bundle\.js').findall( resp_js_id.text)[0] resp = urlquick.get(URL_API_KEY % js_id) api_key = re.compile(r'\"eu1.gigya.com\"\,key\:\"(.*?)\"').findall( resp.text)[0] if plugin.setting.get_string('6play.login') == '' or\ plugin.setting.get_string('6play.password') == '': xbmcgui.Dialog().ok( 'Info', plugin.localize(30604) % ('6play', 'https://www.6play.fr')) return False # Build PAYLOAD payload = { "loginID": plugin.setting.get_string('6play.login'), "password": plugin.setting.get_string('6play.password'), "apiKey": api_key, "format": "jsonp", "callback": "jsonp_3bbusffr388pem4" } # LOGIN resp2 = urlquick.post(URL_COMPTE_LOGIN, data=payload, headers={ 'User-Agent': web_utils.get_random_ua(), 'referer': 'https://www.6play.fr/connexion' }) json_parser = json.loads( resp2.text.replace('jsonp_3bbusffr388pem4(', '').replace(');', '')) if "UID" not in json_parser: plugin.notify('ERROR', '6play : ' + plugin.localize(30711)) return False account_id = json_parser["UID"] account_timestamp = json_parser["signatureTimestamp"] account_signature = json_parser["UIDSignature"] is_helper = inputstreamhelper.Helper('mpd', drm='widevine') if not is_helper.check_inputstream(): return False # Build PAYLOAD headers payload_headers = { 'x-auth-gigya-signature': account_signature, 'x-auth-gigya-signature-timestamp': account_timestamp, 'x-auth-gigya-uid': account_id, 'x-customer-name': 'm6web' } if item_id == '6ter': token_json = urlquick.get(URL_TOKEN_DRM % (account_id, 'dashcenc_%s' % '6T'), headers=payload_headers, max_age=-1) else: token_json = urlquick.get( URL_TOKEN_DRM % (account_id, 'dashcenc_%s' % item_id.upper()), headers=payload_headers, max_age=-1) token_jsonparser = json.loads(token_json.text) token = token_jsonparser["token"] if item_id == '6ter': video_json = urlquick.get( URL_LIVE_JSON % '6T', headers={'User-Agent': web_utils.get_random_ua()}, max_age=-1) json_parser = json.loads(video_json.text) video_assets = json_parser['6T'][0]['live']['assets'] else: video_json = urlquick.get( URL_LIVE_JSON % (item_id.upper()), headers={'User-Agent': web_utils.get_random_ua()}, max_age=-1) json_parser = json.loads(video_json.text) video_assets = json_parser[item_id.upper()][0]['live']['assets'] if not video_assets: plugin.notify('INFO', plugin.localize(30716)) return False subtitle_url = '' if plugin.setting.get_boolean('active_subtitle'): for asset in video_assets: if 'subtitle_vtt' in asset["type"]: subtitle_url = asset['full_physical_path'] for asset in video_assets: if 'delta_dashcenc_h264' in asset["type"]: item = Listitem() item.path = asset['full_physical_path'] if 'http' in subtitle_url: item.subtitles.append(subtitle_url) item.property['inputstreamaddon'] = 'inputstream.adaptive' item.property['inputstream.adaptive.manifest_type'] = 'mpd' item.property[ 'inputstream.adaptive.license_type'] = 'com.widevine.alpha' item.property[ 'inputstream.adaptive.license_key'] = URL_LICENCE_KEY % token item.label = get_selected_item_label() item.art.update(get_selected_item_art()) item.info.update(get_selected_item_info()) return item return False
def get_francetv_video_stream(plugin, id_diffusion, download_mode=False): geoip_value = web_utils.geoip() if not geoip_value: geoip_value = 'FR' resp = urlquick.get(URL_FRANCETV_CATCHUP_PROGRAM_INFO % (id_diffusion, geoip_value), max_age=-1) json_parser = resp.json() if 'video' not in json_parser: plugin.notify('ERROR', plugin.localize(30716)) return False all_video_datas = [] video_datas = json_parser['video'] # Implementer Caption (found case) # Implement DRM (found case) if video_datas['drm'] is not None: all_video_datas.append((video_datas['format'], video_datas['drm'], video_datas['token'])) else: all_video_datas.append((video_datas['format'], None, video_datas['token'])) url_selected = all_video_datas[0][2] if 'hls' in all_video_datas[0][0]: json_parser2 = json.loads( urlquick.get(url_selected, max_age=-1).text) final_video_url = json_parser2['url'] if download_mode: return download.download_video(final_video_url) return final_video_url if 'dash' in all_video_datas[0][0]: is_helper = inputstreamhelper.Helper('mpd') if not is_helper.check_inputstream(): return False item = Listitem() item.property[INPUTSTREAM_PROP] = 'inputstream.adaptive' item.property['inputstream.adaptive.manifest_type'] = 'mpd' item.label = get_selected_item_label() item.art.update(get_selected_item_art()) item.info.update(get_selected_item_info()) if all_video_datas[0][1]: if download_mode: xbmcgui.Dialog().ok(plugin.localize(14116), plugin.localize(30603)) return False item.path = video_datas['url'] token_request = json.loads('{"id": "%s", "drm_type": "%s", "license_type": "%s"}' % (id_diffusion, video_datas['drm_type'], video_datas['license_type'])) token = urlquick.post(video_datas['token'], json=token_request).json()['token'] license_request = '{"token": "%s", "drm_info": [D{SSM}]}' % token license_key = 'https://widevine-proxy.drm.technology/proxy|Content-Type=application%%2Fjson|%s|' % quote_plus(license_request) item.property['inputstream.adaptive.license_type'] = 'com.widevine.alpha' item.property['inputstream.adaptive.license_key'] = license_key else: headers = { 'User-Agent': web_utils.get_random_ua() } json_parser2 = json.loads(urlquick.get(url_selected, headers=headers, max_age=-1).text) resp3 = urlquick.get(json_parser2['url'], headers=headers, max_age=-1, allow_redirects=False) location_url = resp3.headers['location'] item.path = location_url item.property['inputstream.adaptive.stream_headers'] = 'User-Agent=%s' % web_utils.get_random_ua() if download_mode: return download.download_video(item.path) return item # Return info the format is not known return False
def get_video_url(plugin, item_id, video_id, download_mode=False, **kwargs): if get_kodi_version() < 18: video_json = urlquick.get(URL_JSON_VIDEO % video_id, headers={ 'User-Agent': web_utils.get_random_ua(), 'x-customer-name': 'm6web' }, max_age=-1) json_parser = json.loads(video_json.text) video_assets = json_parser['clips'][0]['assets'] if video_assets is None: plugin.notify('ERROR', plugin.localize(30721)) return False final_video_url = '' all_datas_videos_quality = [] all_datas_videos_path = [] for asset in video_assets: if 'http_h264' in asset["type"]: all_datas_videos_quality.append(asset["video_quality"]) all_datas_videos_path.append(asset['full_physical_path']) elif 'h264' in asset["type"]: manifest = urlquick.get( asset['full_physical_path'], headers={'User-Agent': web_utils.get_random_ua()}, max_age=-1) if 'drm' not in manifest.text: all_datas_videos_quality.append(asset["video_quality"]) all_datas_videos_path.append(asset['full_physical_path']) if len(all_datas_videos_quality) == 0: xbmcgui.Dialog().ok('Info', plugin.localize(30602)) return False elif len(all_datas_videos_quality) == 1: final_video_url = all_datas_videos_path[0] else: if DESIRED_QUALITY == "DIALOG": seleted_item = xbmcgui.Dialog().select( plugin.localize(30709), all_datas_videos_quality) if seleted_item == -1: return False return all_datas_videos_path[seleted_item] elif DESIRED_QUALITY == "BEST": url_best = '' i = 0 for data_video in all_datas_videos_quality: if 'lq' not in data_video: url_best = all_datas_videos_path[i] i = i + 1 final_video_url = url_best else: final_video_url = all_datas_videos_path[0] if download_mode: return download.download_video(final_video_url) return final_video_url else: resp_js_id = urlquick.get(URL_GET_JS_ID_API_KEY) js_id = re.compile(r'client\-(.*?)\.bundle\.js').findall( resp_js_id.text)[0] resp = urlquick.get(URL_API_KEY % js_id) api_key = re.compile(r'\"eu1.gigya.com\"\,key\:\"(.*?)\"').findall( resp.text)[0] if plugin.setting.get_string('6play.login') == '' or\ plugin.setting.get_string('6play.password') == '': xbmcgui.Dialog().ok( 'Info', plugin.localize(30604) % ('6play', 'https://www.6play.fr')) return False # Build PAYLOAD payload = { "loginID": plugin.setting.get_string('6play.login'), "password": plugin.setting.get_string('6play.password'), "apiKey": api_key, "format": "jsonp", "callback": "jsonp_3bbusffr388pem4" } # LOGIN resp2 = urlquick.post(URL_COMPTE_LOGIN, data=payload, headers={ 'User-Agent': web_utils.get_random_ua(), 'referer': 'https://www.6play.fr/connexion' }) json_parser = json.loads( resp2.text.replace('jsonp_3bbusffr388pem4(', '').replace(');', '')) if "UID" not in json_parser: plugin.notify('ERROR', '6play : ' + plugin.localize(30711)) return False account_id = json_parser["UID"] account_timestamp = json_parser["signatureTimestamp"] account_signature = json_parser["UIDSignature"] is_helper = inputstreamhelper.Helper('mpd', drm='widevine') if not is_helper.check_inputstream(): return False # Build PAYLOAD headers payload_headers = { 'x-auth-gigya-signature': account_signature, 'x-auth-gigya-signature-timestamp': account_timestamp, 'x-auth-gigya-uid': account_id, 'x-customer-name': 'm6web' } token_json = urlquick.get(URL_TOKEN_DRM % (account_id, video_id), headers=payload_headers, max_age=-1) token_jsonparser = json.loads(token_json.text) token = token_jsonparser["token"] video_json = urlquick.get(URL_JSON_VIDEO % video_id, headers={ 'User-Agent': web_utils.get_random_ua(), 'x-customer-name': 'm6web' }, max_age=-1) json_parser = json.loads(video_json.text) video_assets = json_parser['clips'][0]['assets'] if video_assets is None: plugin.notify('ERROR', plugin.localize(30721)) return False subtitle_url = '' if plugin.setting.get_boolean('active_subtitle'): for asset in video_assets: if 'subtitle_vtt' in asset["type"]: subtitle_url = asset['full_physical_path'] for asset in video_assets: if 'usp_dashcenc_h264' in asset["type"]: item = Listitem() item.path = asset['full_physical_path'] if 'http' in subtitle_url: item.subtitles.append(subtitle_url) item.label = get_selected_item_label() item.art.update(get_selected_item_art()) item.info.update(get_selected_item_info()) item.property['inputstreamaddon'] = 'inputstream.adaptive' item.property['inputstream.adaptive.manifest_type'] = 'mpd' item.property[ 'inputstream.adaptive.license_type'] = 'com.widevine.alpha' item.property[ 'inputstream.adaptive.license_key'] = URL_LICENCE_KEY % token return item for asset in video_assets: if 'http_h264' in asset["type"]: if "hd" in asset["video_quality"]: item = Listitem() item.path = asset['full_physical_path'] if 'http' in subtitle_url: item.subtitles.append(subtitle_url) item.label = get_selected_item_label() item.art.update(get_selected_item_art()) item.info.update(get_selected_item_info()) return item return False