本文整理汇总了Python中core.decoder.Decoder.decodeAdfly方法的典型用法代码示例。如果您正苦于以下问题:Python Decoder.decodeAdfly方法的具体用法?Python Decoder.decodeAdfly怎么用?Python Decoder.decodeAdfly使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core.decoder.Decoder
的用法示例。
在下文中一共展示了Decoder.decodeAdfly方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getChannels
# 需要导入模块: from core.decoder import Decoder [as 别名]
# 或者: from core.decoder.Decoder import decodeAdfly [as 别名]
def getChannels(page):
x = []
if page == '0':
page = RedeneobuxCom.LIST_PAGE
results = RedeneobuxCom.getContentFromUrl(page)
i=0
for result in results.split('<div class="media">'):
if i>0:
element = {}
img = Decoder.extract('<img src=\'',"'",result)
link = Decoder.extract('location.href=\'', "'", result)
title = Decoder.extract('\' alt=\'', "'", result)
if "http" in link:
logger.debug("appending result: "+title+", url: "+link)
element["title"] = title
element["link"] = link
element["thumbnail"] = img
x.append(element)
i+=1
else:
content = RedeneobuxCom.getContentFromUrl(url=page,referer=RedeneobuxCom.LIST_PAGE)
logger.debug("list content is: " + content)
url = Decoder.extractWithRegex('http'," ",content).replace(" ","")
logger.debug("url is: " + url)
if 'adf' in url:
listUrl = Decoder.decodeAdfly(url)
logger.debug("list obtained is: "+listUrl)
m3uContent = Downloader.getSimpleDownload(listUrl) #simple urllib2 download
logger.debug("content: "+m3uContent)
i=0
for lineContent in m3uContent.split('#EXTINF:'):
if i>0:
title = Decoder.extract(',','\n',lineContent)
lineContent = lineContent[lineContent.find("\n"):]
urlContent = Decoder.extractWithRegex('http://',"\n",lineContent).replace('\n','')
element = {}
element["title"] = title
element["link"] = urlContent#+"|"+Downloader.getHeaders(listUrl)
element["thumbnail"] = ''
element["finalLink"] = True
if "://" in urlContent:
logger.debug("added: " + title + ", content: " + urlContent)
x.append(element)
i+=1
return x