Jump to content

Recommended Posts

KA Torrents
Download at Packal

Version: 1.0

Unfortunately, the Piratebay is now down. Whether it will remain down, and if not for how long remains to be seen. I had been using Florian's fantastic Piratebay workflow to easily search and download files. With the servers down, I needed another backend and so another workflow. IMO, KickAss torrents is the best aggregator out there now that Piratebay is gone. So, I wrote a simple workflow to search and download torrents from KickAss.

There is only one keyword filter: torrent. Type that then your query. If you select a result, it will open the magnet link, meaning that your torrent client will automatically open to start downloading. Fast, easy. No whistles.

Enjoy!

Share this post


Link to post

This is interesting but limited. Are you planning on expanding it? Adding categories, possibility to copy magnet link, view top from category? Obviously I've had to start playing with the kickass .json api and it all seems doable :)

Share this post


Link to post

At this moment, I don't plan on expanding it, as I personally don't use any of those features. I'm a man with simple torrent tastes :)

Obviously, though, some people do use those features. And seeing as how Piratebay just might not come back ever, working something up with KA seems like a good idea. I'm busy with other things right now, but I'm willing to help in small bits. Tho, from what I remember, your Piratebay workflow was written in PHP, which I don't know. So, I guess I'm saying, you can take all of my code and build on it and I'm willing to help when I can. Or you can make my workflow obsolete :)

Either way, I'll be fine.

Share this post


Link to post

I understand that! :) Too little time, too much to (possibly) do. That's one of the main reasons this workflow does the bare minimum. I wrote it in an afternoon when Piratebay went down.

Share this post


Link to post

Hi again Stephen,

 

Here is the log for the error I'm getting

 

Thanks,

D. 

 

 

Starting debug for 'KA Torrents'
 
[ERROR: alfred.workflow.input.scriptfilter] Code 1: 19:34:27 workflow.py:1892 ERROR    'NoneType' object has no attribute 'text'
Traceback (most recent call last):
  File "/Users/Damiennew/Library/Application Support/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.E62FD2DC-97FA-4060-B970-A124ADFE4FC4/workflow/workflow.py", line 1890, in run
    func(self)
  File "torrents.py", line 69, in main
    for item in scrape_torrent_site(query):
  File "torrents.py", line 29, in scrape_torrent_site
    label_text = normalise_whitespace(soup.find('tr').text)
AttributeError: 'NoneType' object has no attribute 'text'
19:34:27 workflow.py:1907 DEBUG    Workflow finished in 2.328 seconds.
[ERROR: alfred.workflow.input.scriptfilter] Code 1: 19:34:30 workflow.py:1892 ERROR    'NoneType' object has no attribute 'text'
Traceback (most recent call last):
  File "/Users/Damiennew/Library/Application Support/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.E62FD2DC-97FA-4060-B970-A124ADFE4FC4/workflow/workflow.py", line 1890, in run
    func(self)
  File "torrents.py", line 69, in main
    for item in scrape_torrent_site(query):
  File "torrents.py", line 29, in scrape_torrent_site
    label_text = normalise_whitespace(soup.find('tr').text)
AttributeError: 'NoneType' object has no attribute 'text'
19:34:30 workflow.py:1907 DEBUG    Workflow finished in 2.432 seconds.

Share this post


Link to post

Ok. TBH, I am beginning to suspect that your internet connection is wonky. The workflow runs clean for me every time. The error you are reporting says essentially that there is nothing there. Now, the request went through, so it's not that your internet is off. But the workflow isn't getting anything from the response.

This might also explain the ZotQuery export errors. Can you check your internet connection? Obviously you are getting online, to post here, but the error just doesn't make sense otherwise.

In the meantime, I will try to make a version with some logging so that I can see what's happening in the intermediate steps.

Share this post


Link to post

Hi, I tried to use your workflow but I get this error every time I try to search for something.

Kickass%20Error.png

Do you know what the problem is and how I can resolve it?

Share this post


Link to post

Is it possible to restrict porn and filthy content from showing up?

 

Not in any sensible way that I can of. I personally don't really see any of that, but I'm mostly searching for TV episodes and movies. Is there some way to tell easily? I could filter results, but I would need to know what to filter on.

Share this post


Link to post

Not in any sensible way that I can of. I personally don't really see any of that, but I'm mostly searching for TV episodes and movies. Is there some way to tell easily? I could filter results, but I would need to know what to filter on.

 

Thanks for the reply, a lot of times when I search for almost anything there would be some content that it of that category.

Can you restrict the whole porn branch of the website?

If not maybe you can restrict by a keyword list. If you are able to do that I would be thankful to you. Here is a sample list http://pastebin.com/gpHmA8X5

Share this post


Link to post

Screen_Shot_2015_08_27_at_15_44_19.png

 

Class of magnet link anchor on kat.cr page has changed, so perhaps you should remove 'imagnet ' from the following: 

magnet = item.find('a', {'class': 'imagnet icon16'}).get('href')

Seems to work when I remove it.

 

EDIT:

The following change seems to work properly, by opening a magnet link in torrent application:

magnet = item.find('a', {'title':'Torrent magnet link', 'class': 'icon16'}).get('href')

Debug output below:

Starting debug for 'KA Torrents'

[ERROR: alfred.workflow.input.scriptfilter] Code 1: 15:34:26 workflow.py:1892 ERROR    'NoneType' object has no attribute 'get'
Traceback (most recent call last):
  File "/Users/.../Library/Application Support/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.xxx/workflow/workflow.py", line 1890, in run
    func(self)
  File "torrents.py", line 69, in main
    for item in scrape_torrent_site(query):
  File "torrents.py", line 39, in scrape_torrent_site
    magnet = item.find('a', {'class': 'imagnet icon16'}).get('href')
AttributeError: 'NoneType' object has no attribute 'get'
Edited by dwd

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...