YinYueTaiDownloader.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:YinYueTaiDownloader 作者: PY-Trade 项目源码 文件源码
def handlehtml(url):
    headers = {'User-Agent':'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36'}
    try:
        request = urllib2.Request(url, None, headers)   
        html = urllib2.urlopen(request)
        data = html.read()
        #----------------------------
        reg = re.compile(r"http://\w*?\.yinyuetai\.com/uploads/videos/common/.*?(?=&br)", re.S)
        findlist = re.findall(reg, data)
        #HC(432p) HD(540p) HE(720p)
        #
        if len(findlist) >= 3:
            return findlist[2]
        elif len(findlist) >= 2:
            return findlist[1]
        else:
            return findlist[0]
    except:
        print 'Reading vodeolist failed!'
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号