def retrieveVideoInfo(video_id): video_info = VideoInfo() video_info.set_video_hosting_info(getVideoHostingInfo()) video_info.set_video_id(video_id) try: video_info_link = 'http://www.veoh.com/rest/v2/execute.xml?method=veoh.video.findByPermalink&permalink=' + str( video_id) + '&apiKey=' + API_KEY soup = BeautifulStoneSoup( HttpUtils.HttpClient().getHtmlContent(url=video_info_link), convertEntities=BeautifulStoneSoup.XML_ENTITIES) videoObj = soup.findChild(name='video') video_link = HttpUtils.getRedirectedUrl(str(videoObj['ipodurl'])) img_link = str(videoObj['highresimage']) video_title = str(videoObj['title']) video_info.set_video_stopped(False) video_info.set_video_image(img_link) video_info.set_video_name(video_title) video_info.add_video_link(VIDEO_QUAL_SD, video_link) except: video_info.set_video_stopped(True) return video_info
def retrieveVideoInfo(video_id): video_info = VideoInfo() video_info.set_video_hosting_info(getVideoHostingInfo()) video_info.set_video_id(video_id) try: HttpUtils.HttpClient().enableCookies() html = HttpUtils.HttpClient().getHtmlContent(url='http://www.vplay.ro/watch/' + str(video_id)) html = HttpUtils.HttpClient().getHtmlContent(url='http://www.vplay.ro/play/dinosaur.do', params={'key':str(video_id)}) params = HttpUtils.getUrlParams(html) video_link = HttpUtils.getRedirectedUrl(url=params['nqURL']) HttpUtils.HttpClient().disableCookies() video_info.set_video_stopped(False) video_info.add_video_link(VIDEO_QUAL_SD, video_link) video_info.set_video_image(params['th']) except: video_info.set_video_stopped(True) return video_info
def retrieveVideoInfo(video_id): video_info = VideoInfo() video_info.set_video_hosting_info(getVideoHostingInfo()) video_info.set_video_id(video_id) try: HttpUtils.HttpClient().enableCookies() html = HttpUtils.HttpClient().getHtmlContent( url='http://www.vplay.ro/watch/' + str(video_id)) html = HttpUtils.HttpClient().getHtmlContent( url='http://www.vplay.ro/play/dinosaur.do', params={'key': str(video_id)}) params = HttpUtils.getUrlParams(html) video_link = HttpUtils.getRedirectedUrl(url=params['nqURL']) HttpUtils.HttpClient().disableCookies() video_info.set_video_stopped(False) video_info.add_video_link(VIDEO_QUAL_SD, video_link) video_info.set_video_image(params['th']) except: video_info.set_video_stopped(True) return video_info
def retrieveVideoInfo(video_id): video_info = VideoInfo() video_info.set_video_hosting_info(getVideoHostingInfo()) video_info.set_video_id(video_id) try: video_info_link = 'http://www.veoh.com/rest/v2/execute.xml?method=veoh.video.findByPermalink&permalink=' + str(video_id) + '&apiKey=' + API_KEY soup = BeautifulStoneSoup(HttpUtils.HttpClient().getHtmlContent(url=video_info_link), convertEntities=BeautifulStoneSoup.XML_ENTITIES) videoObj = soup.findChild(name='video') video_link = HttpUtils.getRedirectedUrl(str(videoObj['ipodurl'])) img_link = str(videoObj['highresimage']) video_title = str(videoObj['title']) video_info.set_video_stopped(False) video_info.set_video_image(img_link) video_info.set_video_name(video_title) video_info.add_video_link(VIDEO_QUAL_SD, video_link) except: video_info.set_video_stopped(True) return video_info
def __prepareVideoLink__(videoSourceLink): new_items = [] url = videoSourceLink if re.search('wp.me', url, re.I): url = HttpUtils.getRedirectedUrl(url) if not url.startswith('http://'): url = 'http://' + url Logger.logDebug(url) # contentDiv = BeautifulSoup.SoupStrainer('div', {'class':'left_articles'}) # soup = BeautifulSoup.BeautifulSoup(html, contentDiv) html = HttpUtils.HttpClient().getHtmlContent(url) dek = EnkDekoder.dekode(html) Logger.logDebug(dek) if dek is not None: html = dek html = html.replace('\n\r', '').replace('\r', '').replace('\n', '').replace('\\', '') children = [] if re.search('http://videos.stvflicks.com/', html): docId = re.compile('http://videos.stvflicks.com/(.+?).mp4"').findall(html)[0] children.append('src="http://videos.stvflicks.com/' + docId + '.mp4"') elif re.search('http://playcineflix.com/', html): docId = re.compile('http://playcineflix.com/(.+?).mp4"').findall(html)[0] children.append('src="http://playcineflix.com/' + docId + '.mp4"') elif re.search('https://video.google.com/get_player', html): docId = re.compile('docid=(.+?)"').findall(html)[0] children.append('src="https://docs.google.com/file/d/' + docId + '/preview"') elif re.search('http://videos.videopress.com/', html): docId = re.compile('type="video/mp4" href="http://videos.videopress.com/(.+?).mp4"').findall(html)[0] children.append('src="http://videos.videopress.com/' + docId + '.mp4"') else: children = re.compile('<embed(.+?)>').findall(html) if children is None or len(children) == 0: children = re.compile('<iframe(.+?)>').findall(html) Logger.logDebug(children) for child in children: video_url = re.compile('src="(.+?)"').findall(child)[0] if(re.search('http://ads', video_url, re.I) or re.search('http://ax-d', video_url, re.I)): continue if video_url.startswith('http://goo.gl/'): Logger.logDebug('Found google short URL = ' + video_url) video_url = HttpUtils.getRedirectedUrl(video_url) Logger.logDebug('After finding out redirected URL = ' + video_url) if re.search('videos.desionlinetheater.com', video_url): XBMCInterfaceUtils.displayDialogMessage('Unable to parse', 'A new HTML Guardian is used to protect the page', 'Sounds technical!! hmm, it means cannot find video.', 'Fix: Find me JavaScript Interpreter online service') video_hosting_info = SnapVideo.findVideoHostingInfo(video_url) if video_hosting_info is None: Logger.logDebug('Unrecognized video_url = ' + video_url) continue video_source_img = video_hosting_info.get_video_hosting_image() new_item = ListItem() new_item.add_request_data('videoTitle', 'Part #') new_item.add_request_data('videoLink', video_url) new_item.add_moving_data('videoSourceImg', video_source_img) new_item.add_moving_data('videoSourceName', video_hosting_info.get_video_hosting_name()) new_item.set_next_action_name('Play_Stream') xbmcListItem = xbmcgui.ListItem(label='Part #', iconImage=video_source_img, thumbnailImage=video_source_img) new_item.set_xbmc_list_item_obj(xbmcListItem) new_items.append(new_item) return new_items
def __prepareVideoLink__(videoSourceLink): new_items = [] url = videoSourceLink if re.search('wp.me', url, re.I): url = HttpUtils.getRedirectedUrl(url) if not url.startswith('http://'): url = 'http://' + url Logger.logDebug(url) # contentDiv = BeautifulSoup.SoupStrainer('div', {'class':'left_articles'}) # soup = BeautifulSoup.BeautifulSoup(html, contentDiv) if re.search('', videoSourceLink): video_hosting_info = SnapVideo.findVideoHostingInfo(videoSourceLink) if video_hosting_info is None: Logger.logDebug('Unrecognized video_url = ' + videoSourceLink) else: video_source_img = video_hosting_info.get_video_hosting_image() new_item = ListItem() new_item.add_request_data('videoTitle', 'Part #') new_item.add_request_data('videoLink', videoSourceLink) new_item.add_moving_data('videoSourceImg', video_source_img) new_item.add_moving_data( 'videoSourceName', video_hosting_info.get_video_hosting_name()) new_item.set_next_action_name('Play_Stream') xbmcListItem = xbmcgui.ListItem(label='Part #', iconImage=video_source_img, thumbnailImage=video_source_img) new_item.set_xbmc_list_item_obj(xbmcListItem) new_items.append(new_item) return new_items html = HttpUtils.HttpClient().getHtmlContent(url) dek = EnkDekoder.dekode(html) Logger.logDebug(dek) if dek is not None: html = dek html = html.replace('\n\r', '').replace('\r', '').replace('\n', '').replace('\\', '') children = [] if re.search('http://videos.stvflicks.com/', html): docId = re.compile('http://videos.stvflicks.com/(.+?).mp4"').findall( html)[0] children.append('src="http://videos.stvflicks.com/' + docId + '.mp4"') elif re.search('http://playcineflix.com/', html): docId = re.compile('http://playcineflix.com/(.+?).mp4"').findall( html)[0] children.append('src="http://playcineflix.com/' + docId + '.mp4"') elif re.search('https://video.google.com/get_player', html): docId = re.compile('docid=(.+?)"').findall(html)[0] children.append('src="https://docs.google.com/file/d/' + docId + '/preview"') elif re.search('http://videos.videopress.com/', html): docId = re.compile( 'type="video/mp4" href="http://videos.videopress.com/(.+?).mp4"' ).findall(html)[0] children.append('src="http://videos.videopress.com/' + docId + '.mp4"') elif re.search('http://videos.videopress.com/', html): docId = re.compile( 'type="video/mp4" href="http://videos.videopress.com/(.+?).mp4"' ).findall(html)[0] children.append('src="http://videos.videopress.com/' + docId + '.mp4"') elif re.search('video_alt_url=http://www.mediaplaybox.com', html): docId = re.compile('video_alt_url=http://www.mediaplaybox.com(.+?).mp4' ).findall(html)[0] children.append('src="http://www.mediaplaybox.com:81/' + docId + '.mp4"') elif re.search('video_url=http://www.mediaplaybox.com', html): docId = re.compile( 'video_url=http://www.mediaplaybox.com(.+?).mp4').findall(html)[0] children.append('src="http://www.mediaplaybox.com:81/' + docId + '.mp4"') else: children = re.compile('<embed(.+?)>').findall(html) if children is None or len(children) == 0: children = re.compile('<iframe(.+?)>').findall(html) Logger.logDebug(children) for child in children: video_url = re.compile('src="(.+?)"').findall(child)[0] if (re.search('http://ads', video_url, re.I) or re.search('http://ax-d', video_url, re.I)): continue if video_url.startswith('http://goo.gl/'): Logger.logDebug('Found google short URL = ' + video_url) video_url = HttpUtils.getRedirectedUrl(video_url) Logger.logDebug('After finding out redirected URL = ' + video_url) if re.search('videos.desionlinetheater.com', video_url): XBMCInterfaceUtils.displayDialogMessage( 'Unable to parse', 'A new HTML Guardian is used to protect the page', 'Sounds technical!! hmm, it means cannot find video.', 'Fix: Find me JavaScript Interpreter online service') video_hosting_info = SnapVideo.findVideoHostingInfo(video_url) if video_hosting_info is None: Logger.logDebug('Unrecognized video_url = ' + video_url) continue video_source_img = video_hosting_info.get_video_hosting_image() new_item = ListItem() new_item.add_request_data('videoTitle', 'Part #') new_item.add_request_data('videoLink', video_url) new_item.add_moving_data('videoSourceImg', video_source_img) new_item.add_moving_data('videoSourceName', video_hosting_info.get_video_hosting_name()) new_item.set_next_action_name('Play_Stream') xbmcListItem = xbmcgui.ListItem(label='Part #', iconImage=video_source_img, thumbnailImage=video_source_img) new_item.set_xbmc_list_item_obj(xbmcListItem) new_items.append(new_item) return new_items
def playHostedVideo(request_obj, response_obj): pbType = int(Container().getAddonContext().addon.getSetting('playbacktype')) Container().getAddonContext().addon.setSetting('ga_video_title', 'false') if pbType == 2 and XBMCInterfaceUtils.isPlaying(): response_obj.addServiceResponseParam("status", "error") response_obj.addServiceResponseParam("title", "XBMC is already playing.") response_obj.addServiceResponseParam("message", "Check PlayIt Service add-on settings. Your this request is ignored.") item = ListItem() item.set_next_action_name('respond') response_obj.addListItem(item) else: if pbType == 0: XBMCInterfaceUtils.stopPlayer() video_url = request_obj.get_data()['videoLink'] if video_url.startswith('http://goo.gl/'): Logger.logDebug('Found google short URL = ' + video_url) video_url = HttpUtils.getRedirectedUrl(video_url) Logger.logDebug('After finding out redirected URL = ' + video_url) request_obj.get_data()['videoLink'] = video_url if __is_valid_url(video_url): contentType = __check_media_url(video_url) if contentType is not None: if contentType == 'audio': response_obj.set_redirect_action_name('play_direct_audio') request_obj.get_data()['track_title'] = '' request_obj.get_data()['track_link'] = video_url request_obj.get_data()['track_artwork_url'] = '' else: response_obj.set_redirect_action_name('play_direct_video') else: if XBMCInterfaceUtils.isPlayingAudio(): response_obj.addServiceResponseParam("status", "error") response_obj.addServiceResponseParam("title", "Stop active music!") response_obj.addServiceResponseParam("message", "Note: XBMC cannot play video when audio playback is in progress.") item = ListItem() item.set_next_action_name('respond') response_obj.addListItem(item) else: video_hosting_info = SnapVideo.findVideoHostingInfo(video_url) if video_hosting_info is None: response_obj.addServiceResponseParam("status", "error") response_obj.addServiceResponseParam("title", "URL not supported") response_obj.addServiceResponseParam("message", "Video URL is currently not supported by PlayIt. Please check if URL selected is correct.") item = ListItem() item.set_next_action_name('respond') response_obj.addListItem(item) else: Container().ga_client.reportContentUsage('hostedvideo', video_hosting_info.get_video_hosting_name()) response_obj.addServiceResponseParam("status", "success") if not XBMCInterfaceUtils.isPlaying(): XBMCInterfaceUtils.clearPlayList(list_type="video") response_obj.addServiceResponseParam("message", "Enjoy your video!") else: response_obj.addServiceResponseParam("title", "Request Enqueued!") response_obj.addServiceResponseParam("message", "Your request has been added to player queue.") response_obj.set_redirect_action_name('play_it') request_obj.get_data()['videoTitle'] = 'PlayIt Video' else: Logger.logError('video_url = ' + str(video_url)) response_obj.addServiceResponseParam("status", "error") response_obj.addServiceResponseParam("title", "Invalid URL") response_obj.addServiceResponseParam("message", "Video URL is not valid one! Please check and try again.") item = ListItem() item.set_next_action_name('respond') response_obj.addListItem(item)