本文整理汇总了Python中core.decoder.Decoder.decodeBroadcastst方法的典型用法代码示例。如果您正苦于以下问题:Python Decoder.decodeBroadcastst方法的具体用法?Python Decoder.decodeBroadcastst怎么用?Python Decoder.decodeBroadcastst使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core.decoder.Decoder
的用法示例。
在下文中一共展示了Decoder.decodeBroadcastst方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: extractTargetVideo
# 需要导入模块: from core.decoder import Decoder [as 别名]
# 或者: from core.decoder.Decoder import decodeBroadcastst [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