class platypush.plugins.torrent.TorrentPlugin(download_dir=None, torrent_ports=None, imdb_key=None, popcorn_base_url='', **kwargs)[source]

Bases: Plugin

Plugin to search and download torrents.


  • python-libtorrent-bin (pip install python-libtorrent-bin)

__init__(download_dir=None, torrent_ports=None, imdb_key=None, popcorn_base_url='', **kwargs)[source]
  • download_dir (str) – Directory where the videos/torrents will be downloaded (default: none)

  • torrent_ports (list[int]) – Torrent ports to listen on (default: 6881 and 6891)

  • imdb_key (str) – The IMDb API ( is used to search for movies and series. Insert your IMDb API key if you want support for content search.

  • popcorn_base_url (str) – Custom base URL to use for the PopcornTime API.

download(torrent, download_dir=None, _async=False, event_hndl=None, is_media=False)[source]

Download a torrent.

  • torrent (str) –

    Torrent to download. Supported formats:

    • Magnet URLs

    • Torrent URLs

    • Local torrent file

  • download_dir (str) – Directory to download, overrides the default download_dir attribute (default: None)

  • _async (bool) – If true then the method will add the torrent to the transfer and then return. Updates on the download status should be retrieved either by listening to torrent events or registering the event handler. If false (default) then the method will exit only when the torrent download is complete.

  • event_hndl (function) – A function that takes an event object as argument and is invoked upon a new torrent event (download started, progressing, completed etc.)

  • is_media (bool) – Set it to true if you’re downloading a media file that you’d like to stream as soon as the first chunks are available. If so, then the events and the status method will only include media files


Pause/resume a torrent transfer.


torrent (str) – Torrent URL as returned from get_status()


Quits all the transfers and the active session


Stops and removes a torrent transfer.


torrent (str) – Torrent URL as returned from get_status()


Resume a torrent transfer.


torrent (str) – Torrent URL as returned from get_status()

search(query, category=None, language=None, *args, **kwargs)[source]

Perform a search of video torrents.

  • query (str) – Query string, video name or partial name

  • category (str or list) – Category to search. Supported types: “movies”, “tv”. Default: None (search all categories)

  • language (str) – Language code for the results - example: “en” (default: None, no filter)


Get the status of the current transfers.


torrent (str) – Torrent path, URL or magnet URI whose status will be retrieve (default: None, retrieve all current transfers)


A dictionary in the format torrent_url -> status