chores.py 文件源码

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

项目:piss 作者: AOSC-Dev 项目源码 文件源码
def detect(cls, name, url, **kwargs):
        urlp = urllib.parse.urlparse(url)
        if urlp.netloc != 'github.com':
            return
        pathseg = urlp.path.lstrip('/').split('/')
        if pathseg[0] == 'downloads':
            pathseg.pop(0)
        repo = '/'.join(pathseg[:2])
        if repo.endswith('.git'):
            repo = repo[:-4]
        if len(pathseg) > 2:
            if pathseg[2] == 'releases':
                return cls(name, repo, 'release')
            elif pathseg[2] == 'tags':
                return cls(name, repo, 'tag')
            elif pathseg[2] == 'commits':
                return cls(name, repo, 'commit', pathseg[3])
        for category, url in (
            ('release', 'https://github.com/%s/releases.atom' % repo),
            ('tag', 'https://github.com/%s/tags.atom' % repo),
            ('commit', 'https://github.com/%s/commits/master.atom' % repo)):
            feed = feedparser.parse(url)
            if feed.entries:
                return cls(name, repo, category)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号