def playVideo(main_url): if main_url.find('tudou.com') > 0: import extract_tudou vid_list = extract_tudou.extract_video_from_url(main_url) for i in range(len(vid_list)): url = vid_list[i]['url'].replace( "?1", "?8") # trick to make streaming easier vid_list[i][ 'url'] = url + "|User-Agent=" + vid_list[i]['useragent'] elif main_url.find('youku.com') > 0 or main_url.find('yinyuetai.com') > 0: from extract_withflvcd import extract_withFLVCD vid_list = extract_withFLVCD(urllib.quote_plus(main_url)) elif main_url.find('sohu.com') > 0: import extract_sohu vid_list = extract_sohu.extract_video_from_url(main_url) else: xbmc.Dialog().ok("Unsupported site", main_url) return if len(vid_list) == 0: xbmcgui.Dialog().ok("Fail to extract video", main_url) return pl = xbmc.PlayList(xbmc.PLAYLIST_VIDEO) pl.clear() for vid in vid_list: li = xbmcgui.ListItem(vid['title'], iconImage="DefaultVideo.png") li.setInfo('video', {"Title": vid['title']}) pl.add(vid['url'], li) xbmc.Player().play(pl)
def playVideo(main_url): if main_url.find('tudou.com') > 0: import extract_tudou vid_list = extract_tudou.extract_video_from_url(main_url) for i in range(len(vid_list)): url = vid_list[i]['url'].replace("?1","?8") # trick to make streaming easier vid_list[i]['url'] = url+"|User-Agent="+vid_list[i]['useragent'] elif url.find('sohu.com') > 0: import extract_sohu vid_list = extract_sohu.extract_video_from_url(main_url) elif main_url.find('youku.com') > 0: from extract_withflvcd import extract_withFLVCD vid_list = extract_withFLVCD(urllib.quote_plus(main_url)) else: xbmc.Dialog().ok("Unsupported site", main_url) return if len(vid_list) == 0: xbmcgui.Dialog().ok("Fail to extract video", main_url) return pl = xbmc.PlayList( xbmc.PLAYLIST_VIDEO ) pl.clear() for vid in vid_list: li = xbmcgui.ListItem(vid['title'], iconImage="DefaultVideo.png") li.setInfo( 'video', { "Title": vid['title'] } ) pl.add(vid['url'], li) xbmc.Player().play(pl)
def _playTudou(url): import extract_tudou vid_list = extract_tudou.extract_video_from_url(url) if len(vid_list) == 0: xbmcgui.Dialog().ok("Fail to extract video", url) return pl = xbmc.PlayList(xbmc.PLAYLIST_VIDEO) pl.clear() for vid in vid_list: li = xbmcgui.ListItem(vid['title'], iconImage="DefaultVideo.png") li.setInfo('video', {"Title": vid['title']}) pl.add(vid['url'] + "|User-Agent=" + vid['useragent'], li) xbmc.Player().play(pl)
def _playTudou(url): import extract_tudou vid_list = extract_tudou.extract_video_from_url(url) if len(vid_list) == 0: xbmcgui.Dialog().ok("Fail to extract video", url) return pl = xbmc.PlayList( xbmc.PLAYLIST_VIDEO ) pl.clear() for vid in vid_list: li = xbmcgui.ListItem(vid['title'], iconImage="DefaultVideo.png") li.setInfo( 'video', { "Title": vid['title'] } ) pl.add(vid['url']+"|User-Agent="+vid['useragent'], li) xbmc.Player().play(pl)