本文整理匯總了Python中core.decoder.Decoder.decodeVaughnlivetv方法的典型用法代碼示例。如果您正苦於以下問題:Python Decoder.decodeVaughnlivetv方法的具體用法?Python Decoder.decodeVaughnlivetv怎麽用?Python Decoder.decodeVaughnlivetv使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類core.decoder.Decoder
的用法示例。
在下文中一共展示了Decoder.decodeVaughnlivetv方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: extractTargetVideo
# 需要導入模塊: from core.decoder import Decoder [as 別名]
# 或者: from core.decoder.Decoder import decodeVaughnlivetv [as 別名]
def extractTargetVideo(page):
logger.debug("extracting from page: "+page)
html = Streamgaroo.getContentFromUrl(url=page,referer=Streamgaroo.MAIN_URL)
logger.debug("html is: "+html)
apiKey = Decoder.extract('data-sh="','"',html)
bruteJSON = Streamgaroo.getContentFromUrl(Streamgaroo.CHANNEL_API, "h="+apiKey, Streamgaroo.cookie, Streamgaroo.MAIN_URL)
jsonList = json.loads(bruteJSON)
url2 = jsonList["link"]
logger.debug("using url: "+url2)
html2 = Streamgaroo.getContentFromUrl(url2, "", Streamgaroo.cookie, page)
logger.debug("html2 is: "+html2)
if 'playJS("' in html2:
finalUrl = Decoder.extract('playJS("','"',html2)
logger.debug("found final url: "+finalUrl)
finalUrl = finalUrl.replace("http://www.streamgaroo.com/fetch/r/","") #clean proxies
if 'playlist.m3u8' in finalUrl and '==' in finalUrl:
finalUrl = finalUrl.replace('playlist.m3u8?','chunks.m3u8?')
finalUrl = finalUrl + "|" + urllib.unquote(Downloader.getHeaders())
elif "playStream('iframe','" in html2:
iframeUrl = finalUrl = Decoder.extract("playStream('iframe','","'",html2)
logger.debug("found iframe link: " + iframeUrl)
try:
iframeHtml = Downloader.getContentFromUrl(url=iframeUrl, data=" ", referer=page)
except:
logger.debug("trying second way, easy!!")
import urllib2
req = urllib2.Request(iframeUrl)
req.add_header('Referer', page)
req.add_header('User-Agent', 'Mozilla/5.0 (X11; Linux x86_64; rv:49.0) Gecko/20100101 Firefox/49.0')
resp = urllib2.urlopen(req)
iframeHtml = resp.read()
logger.debug("done!")
pass
logger.debug("html iframe is: "+iframeHtml)
if 'adca.st/broadcast/player' in iframeHtml:
finalUrl = Decoder.decodeBroadcastst(iframeUrl,page)
elif 'vaughnlive.tv/embed/video/' in iframeUrl:
finalUrl = Decoder.decodeVaughnlivetv(iframeUrl,page)
logger.debug("done!")
return finalUrl