vikstrous / pirate-get

A command line interface for The Pirate Bay
GNU Affero General Public License v3.0
337 stars 53 forks source link

Request: filter by category #140

Open gongfarmer opened 4 years ago

gongfarmer commented 4 years ago

I want to be able to list recent torrents to see if my kid's favourite TV show is uploaded without seeing porn titles like "petite sluts anal submission."

I tried to limit it to just the TV category like this:

pirate-get -R -c 205
pirate-get -c "Video/TV shows" -R

However this has no effect, the recent torrents list shows all categories.

I would prefer a category blacklist rather than a whitelist, since it is interesting to see what is going on in ebook uploads and other low-traffic categories. Ideally this would be a config file setting, which applied to the search command as well.

rnhmjoj commented 4 years ago

At the time I rewrote pirate-get to use the new API, the query to get recent torrents didn't take any parameter: it just lists all recent torrent from any category.

This wasn't even possible from the website, which uses the very same API. Unless they have updated the API to make more complex queries, I don't think I can do anything. Can you do it from the site? I haven't checked it in a while.

gongfarmer commented 4 years ago

No, as far as I know this is not a feature of the API. Does the API return list items that include a category id?

What about this:

  1. "recent" query returns items
  2. items with a blacklisted category id are discarded
  3. remaining items are then printed
rnhmjoj commented 4 years ago

Sure, in fact you can already do what you're asking using the JSON output. If you have jq try this:

pirate-get -R -j | jq 'map(select(.category == 205).name)'

The problem with this approach is that the recent query only returns 100 results; so, filtering for a rare category is likely going to discard all results.

gongfarmer commented 4 years ago

Well that's a good start anyway. I'll switch to doing that when I'm just checking what's available. Thanks for the help!