def add_dev(hash): r = gen_random_decimal(0, 99999999999999) client_details = '{"b":"FF","bv":"18.0","ua":"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/20100101 Firefox/18.0"}' adddevice_params = { 'x': 'device', 'a': 'add', 'deviceCode': 'PC', 'deviceHash': hash, 'client': client_details, 'r': r } adddevice_url = wallet_php_url + '?' + urllib.urlencode( adddevice_params) print 'trying to add new device' request = create_req(adddevice_url) response = urllib2.urlopen(request) data = json.load(response) response.close() succ = data[u'ok'] dev_hash = data[u'hash'] if not succ: print 'device cannot be added, exception or "Maximum of free devices already reached"' showError(data[u'msg']) else: print 'device was successfully added' return dev_hash
def menuLink(params): caption = 'try HD first: #1--OK.ru ,#2--openload(try it several clicks until work) ' action = {'info': 1} cap_link = util.makeLink(action) util.addMenuItem(caption, cap_link, icon, fanart, False) url = (params['video']) videoPage = requests.get(url) if videoPage and videoPage.status_code == 200: cont = videoPage.text vidlinks = util.extractAll(cont, '<div id="tab', '/div>') for vidlink in vidlinks: t = util.extract(vidlink, '://', '/') v = util.extract(vidlink, 'SRC="', '"') or util.extract( vidlink, 'src="', '"') paramz = {'play': 1} paramz['title'] = t paramz['videolink'] = v paramz['image'] = params['image'] link = util.makeLink(paramz) util.addMenuItem(paramz['title'], link, 'DefaultVideo.png', paramz['image'], False) else: util.showError(ADDON_ID, 'Could not open URL %s to create menu' % (url)) util.endListing()
def search(): dialog = xbmcgui.Dialog() i = dialog.input('Enter Movie Name:', type=xbmcgui.INPUT_ALPHANUM) q = urllib.quote(i, safe="%/:=&?~#+!$,;'@()*[]") baseurl = 'https://www.google.com.sa/search?rlz=1C1CHZL_enSA679SA679&espv=2&q=el7al.tv+' print q url = baseurl + q + '&oq=el7al.tv+' + q + '&gs_l=serp.3...33231.51533.0.52317.42.30.8.0.0.0.211.4360.0j21j4.25.0....0...1c.1.64.serp..11.22.2813.0..0j30i10k1j0i13k1j0i13i30k1j0i7i30k1j35i39k1j0i131k1j0i10i30k1j0i13i10k1.w4AW4pCV-E4' response = requests.get(url) if response and response.status_code == 200: cont = response.text videos = util.extractAll(cont, '<a href="/url?q=http://el7l.tv/online', 'class="_cD"') for video in videos: t = util.extract(video, '>', '</a>') t1 = (t.replace('\n', '').replace('\t', '').replace('</b>', '').replace('<b>', '').lstrip()) u1 = (util.extract(video, '/', '&')) u = 'http://el7l.tv/play/' + u1 params = {'search': 1} params['url'] = u params['title'] = t1 link = util.makeLink(params) util.addMenuItem(params['title'], link, None, None, True) util.endListing() else: util.showError(ADDON_ID, 'Could not open URL %s to create menu' % (url))
def ololink(params): caption = 'If you have trouble:goto:https://sites.google.com/site/kokiarbic/help' action = {'info': 1} cap_link = util.makeLink(action) util.addMenuItem(caption, cap_link, icon, fanart, False) url = (params['video']) videoPage = requests.get(url) if videoPage and videoPage.status_code == 200: cont = videoPage.text vidlinks = util.extractAll(cont, '"playerst"', '/iframe>') for vidlink in vidlinks: t = 'Movielink' v = util.extract(vidlink, 'SRC="', '"') or util.extract( vidlink, 'src="', '"') paramz = {'play': 1} paramz['title'] = t paramz['videolink'] = v paramz['image'] = params['image'] link = util.makeLink(paramz) util.addMenuItem(paramz['title'], link, 'DefaultVideo.png', paramz['image'], False) else: util.showError(ADDON_ID, 'Could not open URL %s to create menu' % (url)) util.endListing()
def pages(params): page = int(params['page']) p = 'page:' + str(page) util.addMenuItem(p, None, None, None, False) Baseurl = 'http://el7l.tv/online2/12/_%D8%A7%D9%81%D9%84%D8%A7%D9%85_%D8%B9%D8%B1%D8%A8%D9%8A%D8%A9/' url = Baseurl + '%d.html' % (page) response = requests.get(url) if response and response.status_code == 200: cont = response.text videos = util.extractAll(cont, '<div class="file_index">', '/div>') for video in videos: t = util.extract(video, 'alt="', '"') v = util.extract(video, 'a href="http://el7l.tv/online', '"') vp = 'http://el7l.tv/play' + v i = util.extract(video, 'img src="', '"') params = {'listing': 1} params['title'] = t params['video'] = vp params['image'] = i link = util.makeLink(params) util.addMenuItem(params['title'], link, 'DefaultVideo.png', params['image'], True) else: util.showError(ADDON_ID, 'Could not open URL %s to create menu' % (url)) parms = {'old': 1, 'page': str(page + 1)} page_link = util.makeLink(parms) util.addMenuItem('Next Page:>> ', page_link, None, None, True) util.endListing()
def buildMenu(): url = WEB_PAGE_BASE + 'index.php' response = urllib2.urlopen(url) if response and response.getcode() == 200: content = response.read() print content else: util.showError(ADDON_ID, 'Could not open URL %s to create menu' % (url))
def playVideo(params): response = urllib2.urlopen(params['video']) if response and response.getcode() == 200: content = response.read() videoLink = util.extract(content, 'flashvars.File = "', '"') util.playMedia(params['title'], params['image'], videoLink, 'Video') else: util.showError(ADDON_ID, 'Could not open URL %s to get video information' % (params['video']))
def buildMenu(): url = "http://nottstv.com/programmes/" response = urllib2.urlopen(url) path = addon.getAddonInfo('path') if response and response.getcode() == 200: content = response.read() params = {'programme': 1} params['label'] = "Notts TV News Reports" params['tag'] = "news" link = util.makeLink(params) util.addMenuItem(params['label'], link, 'news.png', path + '/images/news.png', True) programmes = util.extractAll(content, 'http://nottstv.com/programmes/', '</a>') for programmelist in programmes: if "jQuery" in programmelist: continue programme = programmelist.split('">') if programme[1] == "Programmes": continue params = {'programme': 1} params['label'] = programme[1] params['tag'] = programme[0] link = util.makeLink(params) thumb = 'DefaultVideo.png' if programme[1] == 'Nottingham Now and Then': thumb = path + '/images/nowandthen.png' if programme[1] == 'Mass Bolero': thumb = path + '/images/massbolero.png' if programme[1] == 'The 6:30 Show': thumb = path + '/images/630show.png' if programme[1] == 'Channel 8 Debate': thumb = path + '/images/8debate.png' if programme[1] == 'Day in the Life': thumb = path + '/images/dayinthelife.png' if programme[1] == 'Inside Industry Week': thumb = path + '/images/insideindustry.jpg' if programme[1] == 'Noise Floor': thumb = path + '/images/noisefloor.png' if programme[1] == 'The Boot Room': thumb = path + '/images/bootroom.png' if programme[1] == 'The Locker Room': thumb = path + '/images/lockerroom.png' if programme[1] == 'Working Week': thumb = path + '/images/workingweek.png' print path util.addMenuItem(params['label'], link, thumb, thumb, True) util.addCategory('>> Current Affairs', 'current-affairs') util.addCategory('>> Entertainment', 'entertainment') util.addCategory('>> Lifestyle', 'lifestyle') util.addCategory('>> Sport', 'sport', path + '/images/sport.jpg') util.addCategory('>> Music', 'music') util.addCategory('>> Specials', 'specials') util.endListing() else: util.showError('plugin.video.nottstv', 'Could not open URL %s to create menu' % (url)) pass
def playVideo(params): response = urllib2.urlopen(params['video']) if response and response.getcode() == 200: content = response.read() videoLink = util.extract(content, 'src=\'" + "', '\"') print videoLink else: util.showError(ADDON_ID, 'Could not open URL %s to get video information' % (params['video']))
def playVideo(params): response = urllib2.urlopen(params['video']) if response and response.getcode() == 200: content = response.read() videoLink = util.extract(content, 'src=\'" + "', '\"') link=videoLink.replace('1000','2500') util.playMedia(params['title'], params['image'], link, 'Video') else: util.showError(ADDON_ID, 'Could not open URL %s to get video information' % (params['video']))
def playVideo(params): link = WEB_PAGE_BASE + params['link'] response = urllib2.urlopen(link) if response and response.getcode() == 200: content = response.read() videoLink = util.extract(content, "source src='", "'") util.playMedia(params['title'], params['image'], videoLink, 'Video') else: util.showError(ADDON_ID, 'Could not open URL %s to get video information' % (params['video']))
def playVideo(params): response = urllib2.urlopen(params['video']) if response and response.getcode() == 200: content = response.read() videoLink = util.extract(content, 'src=\'" + "', '\"') link = videoLink.replace('1000', '2500') util.playMedia(params['title'], params['image'], link, 'Video') else: util.showError( ADDON_ID, 'Could not open URL %s to get video information' % (params['video']))
def fetchFromUrl(url): """ Gets html content from the given url """ try: response = urllib2.urlopen(url, timeout = 30) if response and response.getcode() == 200: return response.read() else: util.showError(_id, 'Could not open URL %s to create menu' % (url)) except socket.timeout, e: log("got timeout error: %r" % e) util.showError(_id, 'Could not open URL %s to create menu' % (url))
def playEpisode(id, thumb): url = "http://api.brightcove.com/services/library?command=find_video_by_id&video_id=" + id + "&video_fields=name,length,iosrenditions&token=1N4JCL3KisuyvNlDIPdrJGpatQ1dVXuaCRtD88vFyCqx6Va1G_yGtg..&sort_by=encodingRate:asc" response = urllib2.urlopen(url) if response and response.getcode() == 200: content = response.read() videolinks = json.loads(content) util.playMedia(videolinks['name'], thumb, videolinks['IOSRenditions'][0]['url']) else: util.showError('plugin.video.nottstv', 'Could not open URL %s to create menu' % (url)) pass
def buildSubMenu(params): response = urllib2.urlopen(params['video']) if response and response.getcode() == 200: content = response.read() videos = util.extractAll(content, '<td width="40%" align="center">', '/td>') for video in videos: params = {'play':1} params['video'] = WEB_PAGE_BASE + util.extract(video, 'a href="', '\"') params['image'] = WEB_PAGE_BASE + util.extract(video, 'img src="', '\"') params['title'] = util.extract(video, '<p align="center">', '</p>') link = util.makeLink(params) util.addMenuItem(params['title'], link, 'DefaultVideo.png', params['image'], False) util.endListing() else: util.showError(ADDON_ID, 'Could not open URL %s to create menu' % (url))
def buildMenu(): url = WEB_PAGE_BASE + '/livetv' response = urllib2.urlopen(url) if response and response.getcode() == 200: content = response.read() video = util.extract(content, '<a class="channel_link"', '</a>') params = {'play':1} params['video'] = WEB_PAGE_BASE + util.extract(video,'href="','\"') params['image'] = util.extract(video,'img src="','\"') params['title'] = util.extract(video,'channel="','\"') link = util.makeLink(params) util.addMenuItem(params['title'], link, 'DefaultVideo.png', params['image'], False) else: util.showError(ADDON_ID, 'Could not open URL %s to create menu' %(url))
def log_in(username, password): print 'logging in...' r = gen_random_decimal(0, 99999999999999) login_params = {'x': 'login', 'regMethod': '', 'regId': '', 'r': r} login_url = user_php_url + '?' + urllib.urlencode(login_params) postdata = urllib.urlencode({'u': username, 'p': password}) request = create_req(login_url, postdata) response = urllib2.urlopen(request) data = json.load(response) response.close() if not data[u'logged']: showError(data[u'msg']) #elif not data[u'subscription']: # print 'you dont have any subscription' # raise showError(session,"Nemáte predplatné") else: print 'succesfully logged in'
def log_in(username, password): print 'logging in...' r = gen_random_decimal(0, 99999999999999) login_params = {'x':'login', 'regMethod':'', 'regId':'', 'r':r} login_url = user_php_url + '?' + urllib.urlencode(login_params) postdata = urllib.urlencode({'u':username, 'p':password}) request = create_req(login_url, postdata) response = urllib2.urlopen(request) data = json.load(response) response.close() if not data[u'logged']: showError(data[u'msg']) #elif not data[u'subscription']: # print 'you dont have any subscription' # raise showError(session,"Nemáte predplatné") else: print 'succesfully logged in'
def buildPlay(inputParams): url = WEB_PAGE_BASE + inputParams['link'] response = urllib2.urlopen(url) if response and response.getcode() == 200: content = response.read() links = util.extractAll(content, '<div class="col">', '</span>') for link in links: params = {'makePlay':1} params['title'] = util.extract(link,'data-original-title="','\"') params['link'] = util.extract(link,'href="','\"') params['image'] = util.extract(link,'img src="','"') link = util.makeLink(params) util.addMenuItem(params['title'], link, params['image'], params['image'], True) util.endListing() xbmc.executebuiltin("Container.SetViewMode(506)") else: util.showError(ADDON_ID, 'Could not open URL SHOW %s to create menu' %(url))
def buildMenu(): url = WEB_PAGE_BASE response = urllib2.urlopen(url) if response and response.getcode() == 200: content = response.read() videos = util.extractAll(content, '<video duration', '</video>') for video in videos: params = {'play': 1} params['video'] = util.extract(video, 'video_id="', '"') params['image'] = util.extract(video, 'default_thumb="', '"') params['title'] = util.extract(video, '<title><![CDATA[', ']]') link = util.makeLink(params) util.addMenuItem(params['title'], link, 'DefaultVideo.png', params['image'], False) util.endListing() else: util.showError(ADDON_ID, 'Could not open URL %s to create menu' % (url))
def buildMenu(): url = WEB_PAGE_BASE response = urllib2.urlopen(url) if response and response.getcode() == 200: content = response.read() params = {} videos = util.extractInfo(content, STARTSTRING, ENDSTRING) for video in videos: linkTitle = util.makeTitle(video) params = {'play':1} params['video'] = 'http://www.tvkstella.pl/play.php?id=%s' % video params['image'] = 'http://www.tvkstella.pl/img/nowe/%s.jpg' % video params['title'] = linkTitle link = util.makeLink(params) util.addMenuItem(linkTitle, link, 'DefaultVideo.png', params['image'], False) util.endListing() else: util.showError(ADDON_ID, 'Could not open URL %s to create menu' % (url))
def buildCategories(): url = WEB_PAGE_BASE + '/the-loai/music' response = urllib2.urlopen(url) if response and response.getcode() == 200: content = response.read() links = util.extractAll(content, 'idscroll="', '<ul class="thumn">') for link in links: params = {'makeCategories':1} params['link'] = util.extract(link,'href="','\"') params['title'] = util.extract(link,'/1">','</a>') link = util.makeLink(params) util.addMenuItem(params['title'], link, 'DefaultVideo.png', 'DefaultVideo.png', True) util.endListing() xbmc.executebuiltin("Container.SetViewMode(506)") else: util.showError(ADDON_ID, 'Could not open URL CATEGORIES %s to create menu' %(url))
def buildMenu(): url = 'http://play.fpt.vn/' response = urllib2.urlopen(url) if response and response.getcode() == 200: content = response.read() makeLinks = util.extract(content, '"nav navbar-nav menu"', '</ul>') links = util.extractAll(makeLinks,'<li >','a>') for link in links: params = {'key':'makeMenu'} params['link'] = util.extract(link,'href="','\"') params['title'] = util.extract(link,'\">','</') link = util.makeLink(params) util.addMenuItem(params['title'], link, 'DefaultVideo.png', 'DefaultVideo.png', True) util.endListing() xbmc.executebuiltin("Container.SetViewMode(500)") else: util.showError(ADDON_ID, 'Could not open URL CATEGORIES %s to create menu' %(url))
def add_dev(hash): r = gen_random_decimal(0, 99999999999999) client_details = '{"b":"FF","bv":"18.0","ua":"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/20100101 Firefox/18.0"}' adddevice_params = {'x':'device', 'a':'add', 'deviceCode':'PC', 'deviceHash':hash, 'client':client_details, 'r':r} adddevice_url = wallet_php_url + '?' + urllib.urlencode(adddevice_params) print 'trying to add new device' request = create_req(adddevice_url) response = urllib2.urlopen(request) data = json.load(response) response.close() succ = data[u'ok'] dev_hash = data[u'hash'] if not succ: print 'device cannot be added, exception or "Maximum of free devices already reached"' showError(data[u'msg']) else: print 'device was successfully added' return dev_hash
def buildMenu(): url = WEB_PAGE_BASE + 'tv_rec.php' response = urllib2.urlopen(url) if response and response.getcode() == 200: content = response.read() videos = util.extractAll(content, '<td class="td_ser">', '</td>') for video in videos: params = {'play': 1} params['video'] = WEB_PAGE_BASE + util.extract( video, '<a href="', '"') params['image'] = "" params['title'] = util.extract( video, 'title="', '"').decode('windows-1251').encode('utf-8') link = util.makeLink(params) util.addMenuItem(params['title'], link, 'DefaultVideo.png', params['image'], False) util.endListing() else: util.showError(ADDON_ID, 'Could not open URL %s to create menu' % (url))
def buildMenu(): url = WEB_PAGE_BASE + '/livetv' response = urllib2.urlopen(url) if response and response.getcode() == 200: content = response.read() videos = util.extractAll(content, '<a class="channel_link"', '</a>') for video in videos: params = {'play': 1} params['video'] = WEB_PAGE_BASE + util.extract( video, 'href="', '\"') params['image'] = util.extract(video, 'img src="', '\"') params['title'] = util.extract(video, 'channel="', '\"') link = util.makeLink(params) util.addMenuItem(params['title'], link, 'DefaultVideo.png', params['image'], False) xbmc.executebuiltin("Container.SetViewMode(52)") util.endListing() else: util.showError(ADDON_ID, 'Could not open URL %s to create menu' % (url))
def searchp(params): url = (params['url']) videoPage = requests.get(url) if videoPage and videoPage.status_code == 200: cont = videoPage.text vidlinks = util.extractAll(cont, '<div id="tab', '/div>') for vidlink in vidlinks: t = util.extract(vidlink, '://', '/') v = util.extract(vidlink, 'SRC="', '"') or util.extract( vidlink, 'src="', '"') paramz = {'play': 1} paramz['title'] = t paramz['videolink'] = v paramz['image'] = icon link = util.makeLink(paramz) util.addMenuItem(paramz['title'], link, paramz['image'], None, False) util.endListing() else: util.showError(ADDON_ID, 'Could not open URL %s to create menu' % (url))
def buildPlay(inputParams): url = WEB_PAGE_BASE + inputParams['link'] response = urllib2.urlopen(url) if response and response.getcode() == 200: content = response.read() links = util.extract(content, 'a href="#">«', 'href="#">»') extractLinks = util.extractAll(links,'a href="','"') for link in extractLinks: params = {'key':'makePlaymakePlay'} params['title'] = util.extractTitle(link) params['link'] = link params['image'] = inputParams['image'] link = util.makeLink(params) util.addMenuItem(params['title'], link, params['image'], params['image'], False) util.endListing() xbmc.executebuiltin("Container.SetViewMode(500)") else: util.showError(ADDON_ID, 'Could not open URL PLAY %s to create menu' %(url))
def parseVideos(content): """ Parses the html content for video links """ matchList = re.findall(r"-(\d{8}).html", content) videoCount = 0 for videoId in set(matchList): videoCount = videoCount + 1 url = WEB_PAGE_BASE + "/videoxml?id=" + videoId[0] + "." + videoId[1:] log('fetch mediaXml: {}'.format(url)) response = urllib2.urlopen(url) if response and response.getcode() == 200: content = response.read() params = parseMediaXML(content) params['play'] = 1 link = util.makeLink(params) util.addVideoMenuItem(params['title'], params['duration'], link, 'DefaultVideo.png', params['image'], False) else: util.showError(_id, 'Could not open URL %s to create menu' % (url)) return videoCount
def getTaggedEpisodes(tag): if tag == "now%20and%20then": url = "http://api.brightcove.com/services/library?command=search_videos&token=1N4JCL3KisuyvNlDIPdrJGpatQ1dVXuaCRtD88vFyCqx6Va1G_yGtg..&video_fields=id,name,videoStillURL,tags&sort_by=start_date:desc&any=custom_fields:" + tag elif tag == "channel%208%20debate": url = "http://api.brightcove.com/services/library?command=search_videos&token=1N4JCL3KisuyvNlDIPdrJGpatQ1dVXuaCRtD88vFyCqx6Va1G_yGtg..&video_fields=id,name,videoStillURL,tags&sort_by=start_date:desc&any=custom_fields:" + tag else: url = "http://api.brightcove.com/services/library?command=search_videos&token=1N4JCL3KisuyvNlDIPdrJGpatQ1dVXuaCRtD88vFyCqx6Va1G_yGtg..&video_fields=id,name,videoStillURL,tags&sort_by=start_date:desc&all=tag:" + tag response = urllib2.urlopen(url) if response and response.getcode() == 200: content = response.read() episodes = json.loads(content) for episode in episodes['items']: params = {'episode': 1} params['label'] = episode['name'] params['id'] = episode['id'] params['thumb'] = episode['videoStillURL'] thumb = episode['videoStillURL'] link = util.makeLink(params) util.addMenuItem(params['label'], link, thumb, thumb, False) util.endListing() else: util.showError('plugin.video.nottstv', 'Could not open URL %s to create menu' % (url)) pass
def VIDEOLINK_TEST(url, name): req = urllib2.Request(url) req.add_header('User-Agent', _UserAgent_) response = urllib2.urlopen(req) httpdata = response.read() response.close() mediaid = re.compile('mainVideo = new mediaData\(.+?, .+?, (.+?),').findall(httpdata) thumb = re.compile('<link rel="image_src" href="(.+?)" />').findall(httpdata) popis = re.compile('<meta name="description" content="(.+?)" />').findall(httpdata) datum = datetime.datetime.now() timestamp = datum.strftime('%Y%m%d%H%M%S') videoid = urllib.quote(nova_app_id + '|' + mediaid[0]) md5hash = nova_app_id + '|' + mediaid[0] + '|' + timestamp + '|' + secret_token try: md5hash = hashlib.md5(md5hash) except: md5hash = md5.new(md5hash) signature = urllib.quote(base64.b64encode(md5hash.digest())) config = nova_service_url + '?t=' + timestamp + '&d=1&tm=nova&h=0&c=' + videoid + '&s=' + signature print config try: desc = popis[0] except: desc = name req = urllib2.Request(config) req.add_header('User-Agent', _UserAgent_) response = urllib2.urlopen(req) httpdata = response.read() response.close() if __settings__.get_setting('test_nastaveni'): print httpdata error_secret_token = re.compile('<errorCode>(.+?)</errorCode>').findall(httpdata) try: chyba = int(error_secret_token[0]) except: chyba = 0 if chyba == 2: print 'Nesprávné tajné heslo' showWarning(u"Doplněk DMD VOYO Nesprávné tajné heslo!") #__settings__.open_settings(session) elif chyba == 1: print 'Špatné časové razítko' showError(u"Doplněk DMD VOYO Pořad lze přehrát pouze na webu Voyo.cz!") #xbmc.executebuiltin("XBMC.Notification('Doplněk DMD VOYO','Pořad lze přehrát pouze na webu Voyo.cz!',30000,"+icon+")") elif chyba == 0: baseurl = re.compile('<baseUrl>(.+?)</baseUrl>').findall(httpdata) streamurl = re.compile('<media>\s<quality>(.+?)</quality>.\s<url>(.+?)</url>\s</media>').findall(httpdata) for kvalita, odkaz in streamurl: #print kvalita,odkaz if re.match('hd', kvalita, re.U): urlhd = odkaz.encode('utf-8') elif re.match('hq', kvalita, re.U): urlhq = odkaz.encode('utf-8') elif re.match('lq', kvalita, re.U): urllq = odkaz.encode('utf-8') print urlhq, urllq swfurl = 'http://voyo.nova.cz/static/shared/app/flowplayer/13-flowplayer.commercial-3.1.5-19-003.swf' if __settings__.get_setting('test_nastaveni'): rtmp_url_lq = baseurl[0] + ' playpath=' + urllq + ' pageUrl=' + url + ' swfUrl=' + swfurl + ' swfVfy=true token=' + rtmp_token rtmp_url_hq = baseurl[0] + ' playpath=' + urlhq + ' pageUrl=' + url + ' swfUrl=' + swfurl + ' swfVfy=true token=' + rtmp_token try: rtmp_url_hd = baseurl[0] + ' playpath=' + urlhd + ' pageUrl=' + url + ' swfUrl=' + swfurl + ' swfVfy=true token=' + rtmp_token except: rtmp_url_hd = 0 else: rtmp_url_lq = baseurl[0] + ' playpath=' + urllq rtmp_url_hq = baseurl[0] + ' playpath=' + urlhq try: rtmp_url_hd = baseurl[0] + ' playpath=' + urlhd except: rtmp_url_hd = 0 if __settings__.get_setting('kvalita_sel') == "HQ": addLink("HQ " + name, rtmp_url_hq, icon, desc) elif __settings__.get_setting('kvalita_sel') == "LQ": addLink("LQ " + name, rtmp_url_lq, icon, desc) elif __settings__.get_setting('kvalita_sel') == "HD": if rtmp_url_hd == 0: addLink("HQ " + name, rtmp_url_hq, icon, desc) else: addLink("HD " + name, rtmp_url_hd, icon, desc) else: addLink("HQ " + name, rtmp_url_hq, icon, desc)
def VIDEOLINK(url, name, live=False): def gen_dev_hash(): r = gen_random_decimal(0, 99999999999999) device_params = {'x':'device', 'a':'generateNewHash', 'userId':urllib.quote(username), 'r':r} devicehash_url = wallet_php_url + '?' + urllib.urlencode(device_params) print 'generating new devicehash' request = create_req(devicehash_url) response = urllib2.urlopen(request) data = json.load(response) response.close() return data[u'hash'] def add_dev(hash): r = gen_random_decimal(0, 99999999999999) client_details = '{"b":"FF","bv":"18.0","ua":"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/20100101 Firefox/18.0"}' adddevice_params = {'x':'device', 'a':'add', 'deviceCode':'PC', 'deviceHash':hash, 'client':client_details, 'r':r} adddevice_url = wallet_php_url + '?' + urllib.urlencode(adddevice_params) print 'trying to add new device' request = create_req(adddevice_url) response = urllib2.urlopen(request) data = json.load(response) response.close() succ = data[u'ok'] dev_hash = data[u'hash'] if not succ: print 'device cannot be added, exception or "Maximum of free devices already reached"' showError(data[u'msg']) else: print 'device was successfully added' return dev_hash if not islogged_in(): log_in(username, password) if dev_hash == "": new_devhash = gen_dev_hash() add_dev(new_devhash) __settings__.setSetting('devhash', new_devhash) # to remove device # http://voyo.nova.cz/profil?sect=subscription request = urllib2.Request(url) request.add_header('User-Agent', _UserAgent_) request.add_header("Referer", url) response = urllib2.urlopen(request) httpdata = response.read() response.close() media_data = re.search('mainVideo = new mediaData\((.+?), (.+?), (.+?),', httpdata) prod = media_data.group(1) unit = media_data.group(2) media = media_data.group(3) site = re.search('siteId: ([0-9]+)', httpdata).group(1) section = re.search('sectionId: ([0-9]+)', httpdata).group(1) subsite = re.search('subsite: \'(.+?)\',', httpdata).group(1) width = re.search('width: ([0-9]+)', httpdata).group(1) height = re.search('height: ([0-9]+)', httpdata).group(1) thumb = re.search('<link rel="image_src" href="(.+?)" />', httpdata) desc = re.search('<meta name="description" content="(.+?)" />', httpdata) desc = (desc and desc.group(1)) or name thumb = thumb and thumb.group(1) r = gen_random_decimal(0, 99999999999999) player_params = { 'x':'playerFlash', 'prod':prod, 'unit':unit, 'media':media, 'site':site, 'section':section, 'subsite':subsite, 'embed':0, 'realSite':site, 'width':width, 'height':height, 'hdEnabled':1, 'hash':'', 'finish':'finishedPlayer', 'dev':dev_hash, 'sts':'undefined', 'r': r, } player_url = player_php_url + '?' + urllib.urlencode(player_params) request = create_req(player_url) response = urllib2.urlopen(request) data = json.load(response) response.close() if data[u'error']: showError(data[u'msg']) elif data[u'html'].find('silverlight') != -1: showError("Požadované video je možné prehrať len na webe VOYO CZ") else: html = data[u'html'] req = urllib2.Request(voyo.get_config_url(html)) req.add_header('User-Agent', _UserAgent_) response = urllib2.urlopen(req) httpdata = response.read() response.close() baseurl = re.compile('<baseUrl>(.+?)</baseUrl>').findall(httpdata) streamurl = re.compile('<media>\s<quality>(.+?)</quality>.\s<url>(.+?)</url>\s</media>').findall(httpdata) for kvalita, odkaz in streamurl: if re.match('hd', kvalita, re.U): urlhd = odkaz.encode('utf-8') elif re.match('hq', kvalita, re.U): urlhq = odkaz.encode('utf-8') elif re.match('lq', kvalita, re.U): urllq = odkaz.encode('utf-8') swfurl = 'http://voyo.nova.cz/static/shared/app/flowplayer/13-flowplayer.commercial-3.1.5-19-003.swf' if live: rtmp_url_lq = baseurl[0] + '/' + urllq + ' live=true' rtmp_url_hq = baseurl[0] + '/' + urllq + ' live=true' else: rtmp_url_lq = baseurl[0] + ' playpath=' + urllq rtmp_url_hq = baseurl[0] + ' playpath=' + urlhq try: if live: rtmp_url_hd = baseurl[0] + '/' + urlhd + ' live=true' else: rtmp_url_hd = baseurl[0] + ' playpath=' + urlhd except: rtmp_url_hd = 0 if __settings__.get_setting('kvalita_sel') == "HQ": addLink("HQ " + name, rtmp_url_hq, icon, desc) elif __settings__.get_setting('kvalita_sel') == "LQ": addLink("LQ " + name, rtmp_url_lq, icon, desc) elif __settings__.get_setting('kvalita_sel') == "HD": if rtmp_url_hd == 0: addLink("HQ " + name, rtmp_url_hq, icon, desc) else: addLink("HD " + name, rtmp_url_hd, icon, desc) else: addLink("HQ " + name, rtmp_url_hq, icon, desc)
def VIDEOLINK(url, name, live=False): def gen_dev_hash(): r = gen_random_decimal(0, 99999999999999) device_params = { 'x': 'device', 'a': 'generateNewHash', 'userId': urllib.quote(username), 'r': r } devicehash_url = wallet_php_url + '?' + urllib.urlencode(device_params) print 'generating new devicehash' request = create_req(devicehash_url) response = urllib2.urlopen(request) data = json.load(response) response.close() return data[u'hash'] def add_dev(hash): r = gen_random_decimal(0, 99999999999999) client_details = '{"b":"FF","bv":"18.0","ua":"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/20100101 Firefox/18.0"}' adddevice_params = { 'x': 'device', 'a': 'add', 'deviceCode': 'PC', 'deviceHash': hash, 'client': client_details, 'r': r } adddevice_url = wallet_php_url + '?' + urllib.urlencode( adddevice_params) print 'trying to add new device' request = create_req(adddevice_url) response = urllib2.urlopen(request) data = json.load(response) response.close() succ = data[u'ok'] dev_hash = data[u'hash'] if not succ: print 'device cannot be added, exception or "Maximum of free devices already reached"' showError(data[u'msg']) else: print 'device was successfully added' return dev_hash if not islogged_in(): log_in(username, password) if dev_hash == "": new_devhash = gen_dev_hash() add_dev(new_devhash) __settings__.setSetting('devhash', new_devhash) # to remove device # http://voyo.nova.cz/profil?sect=subscription request = urllib2.Request(url) request.add_header('User-Agent', _UserAgent_) request.add_header("Referer", url) response = urllib2.urlopen(request) httpdata = response.read() response.close() media_data = re.search('mainVideo = new mediaData\((.+?), (.+?), (.+?),', httpdata) prod = media_data.group(1) unit = media_data.group(2) media = media_data.group(3) site = re.search('siteId: ([0-9]+)', httpdata).group(1) section = re.search('sectionId: ([0-9]+)', httpdata).group(1) subsite = re.search('subsite: \'(.+?)\',', httpdata).group(1) width = re.search('width: ([0-9]+)', httpdata).group(1) height = re.search('height: ([0-9]+)', httpdata).group(1) thumb = re.search('<link rel="image_src" href="(.+?)" />', httpdata) desc = re.search('<meta name="description" content="(.+?)" />', httpdata) desc = (desc and desc.group(1)) or name thumb = thumb and thumb.group(1) r = gen_random_decimal(0, 99999999999999) player_params = { 'x': 'playerFlash', 'prod': prod, 'unit': unit, 'media': media, 'site': site, 'section': section, 'subsite': subsite, 'embed': 0, 'realSite': site, 'width': width, 'height': height, 'hdEnabled': 1, 'hash': '', 'finish': 'finishedPlayer', 'dev': dev_hash, 'sts': 'undefined', 'r': r, } player_url = player_php_url + '?' + urllib.urlencode(player_params) request = create_req(player_url) response = urllib2.urlopen(request) data = json.load(response) response.close() if data[u'error']: showError(data[u'msg']) elif data[u'html'].find('silverlight') != -1: showError("Požadované video je možné prehrať len na webe VOYO CZ") else: html = data[u'html'] req = urllib2.Request(voyo.get_config_url(html)) req.add_header('User-Agent', _UserAgent_) response = urllib2.urlopen(req) httpdata = response.read() response.close() baseurl = re.compile('<baseUrl>(.+?)</baseUrl>').findall(httpdata) streamurl = re.compile( '<media>\s<quality>(.+?)</quality>.\s<url>(.+?)</url>\s</media>' ).findall(httpdata) for kvalita, odkaz in streamurl: if re.match('hd', kvalita, re.U): urlhd = odkaz.encode('utf-8') elif re.match('hq', kvalita, re.U): urlhq = odkaz.encode('utf-8') elif re.match('lq', kvalita, re.U): urllq = odkaz.encode('utf-8') swfurl = 'http://voyo.nova.cz/static/shared/app/flowplayer/13-flowplayer.commercial-3.1.5-19-003.swf' if live: rtmp_url_lq = baseurl[0] + '/' + urllq + ' live=true' rtmp_url_hq = baseurl[0] + '/' + urllq + ' live=true' else: rtmp_url_lq = baseurl[0] + ' playpath=' + urllq rtmp_url_hq = baseurl[0] + ' playpath=' + urlhq try: if live: rtmp_url_hd = baseurl[0] + '/' + urlhd + ' live=true' else: rtmp_url_hd = baseurl[0] + ' playpath=' + urlhd except: rtmp_url_hd = 0 if __settings__.get_setting('kvalita_sel') == "HQ": addLink("HQ " + name, rtmp_url_hq, icon, desc) elif __settings__.get_setting('kvalita_sel') == "LQ": addLink("LQ " + name, rtmp_url_lq, icon, desc) elif __settings__.get_setting('kvalita_sel') == "HD": if rtmp_url_hd == 0: addLink("HQ " + name, rtmp_url_hq, icon, desc) else: addLink("HD " + name, rtmp_url_hd, icon, desc) else: addLink("HQ " + name, rtmp_url_hq, icon, desc)
def VIDEOLINK_TEST(url, name): req = urllib2.Request(url) req.add_header('User-Agent', _UserAgent_) response = urllib2.urlopen(req) httpdata = response.read() response.close() mediaid = re.compile( 'mainVideo = new mediaData\(.+?, .+?, (.+?),').findall(httpdata) thumb = re.compile('<link rel="image_src" href="(.+?)" />').findall( httpdata) popis = re.compile('<meta name="description" content="(.+?)" />').findall( httpdata) datum = datetime.datetime.now() timestamp = datum.strftime('%Y%m%d%H%M%S') videoid = urllib.quote(nova_app_id + '|' + mediaid[0]) md5hash = nova_app_id + '|' + mediaid[ 0] + '|' + timestamp + '|' + secret_token try: md5hash = hashlib.md5(md5hash) except: md5hash = md5.new(md5hash) signature = urllib.quote(base64.b64encode(md5hash.digest())) config = nova_service_url + '?t=' + timestamp + '&d=1&tm=nova&h=0&c=' + videoid + '&s=' + signature print config try: desc = popis[0] except: desc = name req = urllib2.Request(config) req.add_header('User-Agent', _UserAgent_) response = urllib2.urlopen(req) httpdata = response.read() response.close() if __settings__.get_setting('test_nastaveni'): print httpdata error_secret_token = re.compile('<errorCode>(.+?)</errorCode>').findall( httpdata) try: chyba = int(error_secret_token[0]) except: chyba = 0 if chyba == 2: print 'Nesprávné tajné heslo' showWarning(u"Doplněk DMD VOYO Nesprávné tajné heslo!") #__settings__.open_settings(session) elif chyba == 1: print 'Špatné časové razítko' showError(u"Doplněk DMD VOYO Pořad lze přehrát pouze na webu Voyo.cz!") #xbmc.executebuiltin("XBMC.Notification('Doplněk DMD VOYO','Pořad lze přehrát pouze na webu Voyo.cz!',30000,"+icon+")") elif chyba == 0: baseurl = re.compile('<baseUrl>(.+?)</baseUrl>').findall(httpdata) streamurl = re.compile( '<media>\s<quality>(.+?)</quality>.\s<url>(.+?)</url>\s</media>' ).findall(httpdata) for kvalita, odkaz in streamurl: #print kvalita,odkaz if re.match('hd', kvalita, re.U): urlhd = odkaz.encode('utf-8') elif re.match('hq', kvalita, re.U): urlhq = odkaz.encode('utf-8') elif re.match('lq', kvalita, re.U): urllq = odkaz.encode('utf-8') print urlhq, urllq swfurl = 'http://voyo.nova.cz/static/shared/app/flowplayer/13-flowplayer.commercial-3.1.5-19-003.swf' if __settings__.get_setting('test_nastaveni'): rtmp_url_lq = baseurl[ 0] + ' playpath=' + urllq + ' pageUrl=' + url + ' swfUrl=' + swfurl + ' swfVfy=true token=' + rtmp_token rtmp_url_hq = baseurl[ 0] + ' playpath=' + urlhq + ' pageUrl=' + url + ' swfUrl=' + swfurl + ' swfVfy=true token=' + rtmp_token try: rtmp_url_hd = baseurl[ 0] + ' playpath=' + urlhd + ' pageUrl=' + url + ' swfUrl=' + swfurl + ' swfVfy=true token=' + rtmp_token except: rtmp_url_hd = 0 else: rtmp_url_lq = baseurl[0] + ' playpath=' + urllq rtmp_url_hq = baseurl[0] + ' playpath=' + urlhq try: rtmp_url_hd = baseurl[0] + ' playpath=' + urlhd except: rtmp_url_hd = 0 if __settings__.get_setting('kvalita_sel') == "HQ": addLink("HQ " + name, rtmp_url_hq, icon, desc) elif __settings__.get_setting('kvalita_sel') == "LQ": addLink("LQ " + name, rtmp_url_lq, icon, desc) elif __settings__.get_setting('kvalita_sel') == "HD": if rtmp_url_hd == 0: addLink("HQ " + name, rtmp_url_hq, icon, desc) else: addLink("HD " + name, rtmp_url_hd, icon, desc) else: addLink("HQ " + name, rtmp_url_hq, icon, desc)
def VIDEOLINK(url, name): def gen_dev_hash(): r = gen_random_decimal(0, 99999999999999) device_params = {'x':'device', 'a':'generateNewHash', 'userId':urllib.quote(username), 'r':r} devicehash_url = wallet_php_url + '?' + urllib.urlencode(device_params) print 'generating new devicehash' request = create_req(devicehash_url) response = urllib2.urlopen(request) data = json.load(response) response.close() return data[u'hash'] def add_dev(hash): r = gen_random_decimal(0, 99999999999999) client_details = '{"b":"FF","bv":"18.0","ua":"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/20100101 Firefox/18.0"}' adddevice_params = {'x':'device', 'a':'add', 'deviceCode':'PC', 'deviceHash':hash, 'client':client_details, 'r':r} adddevice_url = wallet_php_url + '?' + urllib.urlencode(adddevice_params) print 'trying to add new device' request = create_req(adddevice_url) response = urllib2.urlopen(request) data = json.load(response) response.close() succ = data[u'ok'] dev_hash = data[u'hash'] if not succ: print 'device cannot be added, exception or "Maximum of free devices already reached"' showError(data[u'msg']) else: print 'device was successfully added' return dev_hash if not islogged_in(): log_in(username, password) global dev_hash if dev_hash == "": new_devhash = gen_dev_hash() add_dev(new_devhash) dev_hash = new_devhash __settings__.setSetting('devhash', new_devhash) # to remove device # http://voyo.markiza.sk/profil?sect=subscription request = urllib2.Request(url) request.add_header('User-Agent', _UserAgent_) request.add_header("Referer", url) response = urllib2.urlopen(request) httpdata = response.read() response.close() media_data = re.search('mainVideo = new mediaData\((.+?), (.+?), (.+?),', httpdata) prod = media_data.group(1) unit = media_data.group(2) media = media_data.group(3) site = re.search('siteId: ([0-9]+)', httpdata).group(1) section = re.search('sectionId: ([0-9]+)', httpdata).group(1) subsite = re.search('subsite: \'(.+?)\',', httpdata).group(1) width = re.search('width: ([0-9]+)', httpdata).group(1) height = re.search('height: ([0-9]+)', httpdata).group(1) r = gen_random_decimal(0, 99999999999999) player_params = { 'x':'playerFlash', 'prod':prod, 'unit':unit, 'media':media, 'site':site, 'section':section, 'subsite':subsite, 'embed':0, 'realSite':site, 'width':width, 'height':height, 'hdEnabled':1, 'hash':'', 'finish':'finishedPlayer', 'dev':dev_hash, 'sts':'undefined', 'r': r, } player_url = player_php_url + '?' + urllib.urlencode(player_params) request = create_req(player_url) response = urllib2.urlopen(request) data = json.load(response) response.close() if data[u'error']: showError(data[u'msg']) else: html = data[u'html'] exec(base64.decodestring("Y29uZmlnX2FlcyA9IHJlLnNlYXJjaCgndmFyIHZveW9QbHVzQ29uZmlnLipbXiJdKyIoLis/KSI7\nJywgaHRtbCwgcmUuRE9UQUxMKS5ncm91cCgxKTtjb25maWcgPSBhZXMuZGVjcnlwdChjb25maWdf\nYWVzLCAnRWFEVXV0ZzRwcEdZWHdOTUZkUkpzYWRlbkZTbkk2Z0onLCAxMjgpLnJlcGxhY2UoJ1wv\nJywnLycpO3NlY3JldCA9IHJlLnNlYXJjaChyJyJzZWNyZXQiOiIoLis/KSInLCBjb25maWcpLmdy\nb3VwKDEpO2FwcF9pZCA9IHJlLnNlYXJjaChyJyJhcHBJZCI6IiguKz8pIicsIGNvbmZpZykuZ3Jv\ndXAoMSk7c2VydmljZV91cmwgPSByZS5zZWFyY2gocicic2VydmljZVVybCI6IiguKz8pIicsIGNv\nbmZpZykuZ3JvdXAoMSk7dGltZV9zZXJ2aWNlX3VybCA9IHJlLnNlYXJjaChyJyJ0aW1lU2Vydmlj\nZVVybCI6IiguKz8pIicsIGNvbmZpZykuZ3JvdXAoMSk7dGltZXN0YW1wID0gbWFya2l6YV9yZWFk\nKHRpbWVfc2VydmljZV91cmwpWzoxNF07c2lnbmF0dXJlID0gYmFzZTY0LmI2NGVuY29kZShoYXNo\nbGliLm1kNSgiezB9fHsxfXx7Mn18ezN9Ii5mb3JtYXQoYXBwX2lkLCBtZWRpYSwgdGltZXN0YW1w\nLCBzZWNyZXQpKS5kaWdlc3QoKSk7c2VydmljZV91cmwgPSAiezB9P3Q9ezF9JmQ9MSZjPXsyfXx7\nM30maD0wJnRtPW5vdmEmcz17NH0iLmZvcm1hdChzZXJ2aWNlX3VybCx0aW1lc3RhbXAsYXBwX2lk\nLG1lZGlhLHVybGxpYi5xdW90ZShzaWduYXR1cmUpKQ==\n")) in globals(),locals() service_xml = markiza_read(service_url) baseurl = re.compile('<baseUrl>(.+?)</baseUrl>').findall(service_xml) baseurl = re.sub(r'<!\[CDATA\[([^\]]+)\]\]>',r'\1',baseurl[0]) streamurl = re.compile('<media>\s*<quality>(.+?)</quality>\s*<url>(.+?)</url>\s*</media>').findall(service_xml) for quality, playpath in streamurl: quality = re.sub(r'<!\[CDATA\[([^\]]+)\]\]>',r'\1', quality) playpath = re.sub(r'<!\[CDATA\[([^\]]+)\]\]>',r'\1', playpath) url = "%s playpath=%s" % (baseurl, playpath) if quality == 'hq': continue addLink(name, url, None)