torrent-hound.py 文件源码

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

项目:torrent-hound 作者: baddymaster 项目源码 文件源码
def parse_results_rarbg(response_json):
    global results_rarbg
    if error_detected_rarbg == False:
        for post in response_json['torrent_results']:
            res = {}
            res['name'] = post['title']
            res['link'] = post['info_page']

            temp_size = humanize.naturalsize(post['size'], binary=True, format='%.2f')
            s1 = temp_size.split('.')
            if(len(s1[0]) == 4):
                res['size'] = humanize.naturalsize(post['size'], binary=True, format='%.0f')
            elif(len(s1[1]) == 3):
                res['size'] = humanize.naturalsize(post['size'], binary=True, format='%.1f')
            else:
                res['size'] = temp_size
            #res['time'] = Implement later
            res['seeders'] = post['seeders']
            res['leechers'] = post['leechers']
            try:
                res['ratio'] = format( (float(res['seeders'])/float(res['leechers'])), '.1f' )
            except ZeroDivisionError:
                res['ratio'] = float('inf')
            res['magnet'] = post['download']
            results_rarbg.append(res)
    else:
        print "----------- " + colored.green('RARBG') + " -----------"
        print "             [No results found]                "
        return []
    return results_rarbg
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号