JuanjoSalvador / NyaaPy

Unofficial Python wrapper for Nyaa anime torrent sites
MIT License
47 stars 23 forks source link

[Nyaa.si][last_uploaded_torrents] How about using RSS? #50

Closed husudosu closed 2 years ago

husudosu commented 4 years ago

I guess it would be a little faster, using RSS source for last uploaded torrents. What do you think about it? It can done via LXML or we could use feed_parser library. RSS source contains almost every torrent of the first page of nyaa (1 missing if I saw it correctly).

JuanjoSalvador commented 4 years ago

At some point, this feature was part of the module. But I can't remember why I removed it. I think we can add this again, go for it.

Euklios commented 2 years ago

@JuanjoSalvador

Problematic about using RSS is the additional complexity. While using https://nyaa.si/?page=rss yields an RSS (XML) response, using the same logic on users (https://nyaa.si/user/ohys?page=rss) will result in a normal HTML response. Therefore, while possible in some scenarios, we would still have to maintain the HTML parser aside from the XML data extraction.

This might be the reason why you removed it in the first place.

JuanjoSalvador commented 2 years ago

I think we could keep the eye on RSS frontpage and avoid the users RSS, or slit it into two separate functions. Let me give it a try.

Euklios commented 2 years ago

If you're interested, I just had a look myself. But unfortunately, the completed_count is the only thing that we can't read from the RSS feed is the completed_count. Additionally, the magnet link has to be generated. Otherwise, all information is present within the feed.

If you're interested, I could do a cleanup of my fork and create a PR (https://github.com/Euklios/NyaaPy/commit/a89bca61e50b7b9e0004a8af9c598956c16a76a3)

JuanjoSalvador commented 2 years ago

Feel free to create the PR :D I'm gonna add some tests and checks today to the repo, so in case you're gonna make a PR, make sure your code is PEP8-compilant.

kotx commented 1 year ago

While using https://nyaa.si/?page=rss yields an RSS (XML) response, using the same logic on users (https://nyaa.si/user/ohys?page=rss) will result in a normal HTML response.

You can use https://nyaa.si/?page=rss&u=ohys, though.