Youdao-Anki.py 文件源码

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

项目:Anki-Youdao 作者: megachweng 项目源码 文件源码
def totalPage(self):

        self.loadedCookies = self.loadCookies()
        if not self.loadedCookies:
            return False
        # page index start from 0 end at max-1
        req = urllib2.Request('http://dict.youdao.com/wordbook/wordlist?p=0&tags=')
        opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(self.loadedCookies))
        urllib2.install_opener(opener)
        response = urllib2.urlopen(req)
        source = response.read()
        if '????' in source:
            return False
        else:
            try:
                return int(re.search('<a href="wordlist.p=(.*).tags=" class="next-page">????</a>', source, re.M | re.I).group(1)) - 1
            except Exception:
                return 1
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号