Created
November 21, 2015 06:10
-
-
Save zodman/526a959bd3fa4dfe931c to your computer and use it in GitHub Desktop.
Get all torrents for a fansub with titles
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env python | |
from nyaa import nyaa | |
import guessit | |
import click | |
@click.command() | |
@click.argument("nyaa_user") | |
@click.option("--num_page", default=10, help="Numero de paginas rss a obtener") | |
def fetch_nyaa_user(nyaa_user, num_page): | |
""" obtiene de nyaa (rss) todos las series y hace batchs de torrents """ | |
result = [] | |
for i in range(0,num_page): | |
result += nyaa.search(user=nyaa_user, offset=i) | |
db = {} | |
for res in result: | |
data = {'link':res.link, 'release_date':res.date, 'origin_title':res.title} | |
link = res.link | |
title = res.title | |
guessit_dict = guessit.guess_file_info(title) | |
db.setdefault(guessit_dict.get("series",guessit_dict.get("title",title)),[]).append(link) | |
for i in db.keys(): | |
click.echo(i + " (%s)" % len(db[i])) | |
for j in db[i]: | |
click.echo(j) | |
if __name__ =="__main__": | |
fetch_nyaa_user() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment