Torvend Package

This is the base torvend package (not including the command line utility). The packages that developers should typically interact with are client, items, and spiders. Other packages are mainly used internally and typically dont need to be modified.

torvend.client

class torvend.client.TorvendClient(settings={}, ignored=[], allowed=[], verbose=False)[source]

Bases: torvend.meta.loggable.Loggable

The client for discovering torrents.

settings

Overrides for default client scrapy settings.

Getter:Returns overriding dictionary of client scrapy settings
Setter:Sets the overriding settings
Return type:dict[str,…]
ignored

A list of ignored spider classes.

Getter:Returns a list of ignored spider classes
Setter:Sets the list of ignored spider classes
Return type:list[torvend.spiders._common.BaseSpider]
allowed

A list of allowed spider classes.

Getter:Returns a list of allowed spider classes
Setter:Sets the list of allowed spider classes
Return type:list[torvend.spiders._common.BaseSpider]
verbose

Indicates if verbose logging is enabled.

Getter:Returns True if verbose logging is enabled
Setter:Sets the verbose flag
Return type:bool
get_spiders()[source]

Returns a list of spider classes.

Returns:A list of spider classes
Return type:list[torvend.spiders._common.BaseSpider]
search(query, callback, results=30)[source]

Starts the search process for a given query.

Note

The callback method must accept at least a positional argument named item. This is the discovered torrent item.

Parameters:
  • query (str) – The query text to search with
  • callback (callable) – A callback which receives torrent items
  • results (int) – The minimum number of results for each spider to return

torvend.items

class torvend.items.TorrentCategory[source]

Bases: enum.Enum

A enumeration of generic torrent categorizations.

Unknown = 'unknown'
Audio = 'audio'
Video = 'video'
Image = 'image'
Application = 'application'
Game = 'game'
Book = 'book'
Adult = 'adult'
class torvend.items.Torrent(*args, **kwargs)[source]

Bases: scrapy.item.Item

An item that describes a torrent.

Note

The attributes of these scrapy items can only be retrieved by indexing the object like a dictionary. The same is true for setting the attributes of the object.

torrent_name = torrent_instance['name']
torrent_instance['name'] = new_torrent_name
Parameters:
  • spider (str) – The spider name which discovered the torrent
  • source (str) – The source url of the torrent
  • name (str) – The name of the torrent
  • size (int) – The size in bytes of the torrent
  • hash (str) – The infohash of the torrent
  • magnet (str) – The magnet link of the torrent
  • categories (list[torvend.items.TorrentCategory]) – A list of applicable categories
  • seeders (int) – The number of seeder
  • leechers (int) – The number of leechers
  • uploaded (datetime.datetime) – The datetime to torrent was uploaded
  • uploader (str) – The username of the uploader
fields = {'name': {}, 'categories': {'serializer': <function Torrent.<lambda>>}, 'uploaded': {'serializer': <class 'str'>}, 'spider': {}, 'leechers': {'serializer': <class 'int'>}, 'seeders': {'serializer': <class 'int'>}, 'magnet': {}, 'uploader': {}, 'hash': {}, 'source': {}, 'size': {'serializer': <class 'int'>}}

torvend.spiders

Below are a list of currently included spiders that can be utilized by TorvendClient. These spiders are just scrapy spiders built to yield as many torrent items as possible until a given results threshold is met.

Important

These spiders are very dependent on the responses made from search requests by the spider. This means that as a spider’s targeted site updates their search method (or views), the spider will most likely need to be updated as well.

idope

class torvend.spiders.idope.IDopeSpider(query=None, results=30, *args, **kwargs)[source]

Bases: torvend.spiders._common.BaseSpider

The spider for idope.se.

name = 'idope'
allowed_domains = ['idope.se']
paging_index

Required property for paging indexing.

Returns:The starting index of pages
Return type:int
paging_results

Required property for paging results.

Returns:The number of results per queried page
Return type:int
query_scheme

Required property for query scheme.

Returns:The scheme the query needs
Return type:str
query_path

Required property for the query path.

Returns:The path the query needs
Return type:str
parse(response)[source]

Required first level page parser.

Parameters:response (scrapy.Request) – The response instance from start_requests
Returns:Yields torrent items
Return type:list[items.Torrent]

thepiratebay

class torvend.spiders.thepiratebay.ThePirateBaySpider(query=None, results=30, *args, **kwargs)[source]

Bases: torvend.spiders._common.BaseSpider

The spider for thepiratebay.org.

name = 'thepiratebay'
allowed_domains = ['thepiratebay.org', 'thepiratebay.se']
paging_index

Required property for paging indexing.

Returns:The starting index of pages
Return type:int
paging_results

Required property for paging results.

Returns:The number of results per queried page
Return type:int
query_scheme

Required property for query scheme.

Returns:The scheme the query needs
Return type:str
query_path

Required property for the query path.

Returns:The path the query needs
Return type:str
parse(response)[source]

Required first level page parser.

Parameters:response (scrapy.Request) – The response instance from start_requests
Returns:Yields torrent items
Return type:list[items.Torrent]

torrentz2

class torvend.spiders.torrentz2.Torrentz2Spider(query=None, results=30, *args, **kwargs)[source]

Bases: torvend.spiders._common.BaseSpider

The spider for torrentz2.eu.

name = 'torrentz2'
allowed_domains = ['torrentz2.eu']
paging_index

Required property for paging indexing.

Returns:The starting index of pages
Return type:int
paging_results

Required property for paging results.

Returns:The number of results per queried page
Return type:int
query_scheme

Required property for query scheme.

Returns:The scheme the query needs
Return type:str
query_path

Required property for the query path.

Returns:The path the query needs
Return type:str
parse(response)[source]

Required first level page parser.

Parameters:response (scrapy.Request) – The response instance from start_requests
Returns:Yields torrent items
Return type:list[items.Torrent]

1337x

class torvend.spiders.onethreethreesevenx.OneThreeThreeSevenXSpider(query=None, results=30, *args, **kwargs)[source]

Bases: torvend.spiders._common.BaseSpider

The spider for 1337x.to.

name = '1337x'
allowed_domains = ['1337x.to']
paging_index

Required property for paging indexing.

Returns:The starting index of pages
Return type:int
paging_results

Required property for paging results.

Returns:The number of results per queried page
Return type:int
query_scheme

Required property for query scheme.

Returns:The scheme the query needs
Return type:str
query_path

Required property for the query path.

Returns:The path the query needs
Return type:str
parse(response)[source]

Required first level page parser.

Parameters:response (scrapy.Request) – The response instance from start_requests
Returns:Yields additional scrapy requests
Return type:list[scrapy.Request]

limetorrents

class torvend.spiders.limetorrents.LimeTorrentsSpider(query=None, results=30, *args, **kwargs)[source]

Bases: torvend.spiders._common.BaseSpider

name = 'limetorrents'
allowed_domains = ['www.limetorrents.cc']
paging_index

Required property for paging indexing.

Returns:The starting index of pages
Return type:int
paging_results

Required property for paging results.

Returns:The number of results per queried page
Return type:int
query_scheme

Required property for query scheme.

Returns:The scheme the query needs
Return type:str
query_path

Required property for the query path.

Returns:The path the query needs
Return type:str
parse(response)[source]

Required first level page parser.

Parameters:response (scrapy.Request) – The response instance from start_requests
Returns:Yields additional scrapy requests
Return type:list[scrapy.Request]

skytorrents

class torvend.spiders.skytorrents.SkyTorrentsSpider(query=None, results=30, *args, **kwargs)[source]

Bases: torvend.spiders._common.BaseSpider

name = 'skytorrents'
allowed_domains = ['skytorrents.in']
paging_index

Required property for paging indexing.

Returns:The starting index of pages
Return type:int
paging_results

Required property for paging results.

Returns:The number of results per queried page
Return type:int
query_scheme

Required property for query scheme.

Returns:The scheme the query needs
Return type:str
query_path

Required property for the query path.

Returns:The path the query needs
Return type:str
parse(response)[source]

Required first level page parser.

Parameters:response (scrapy.Request) – The response instance from start_requests
Returns:Yields additional scrapy requests
Return type:list[scrapy.Request]

torlock

class torvend.spiders.torlock.TorlockSpider(query=None, results=30, *args, **kwargs)[source]

Bases: torvend.spiders._common.BaseSpider

name = 'torlock'
allowed_domains = ['torlock.com']
paging_index

Required property for paging indexing.

Returns:The starting index of pages
Return type:int
paging_results

Required property for paging results.

Returns:The number of results per queried page
Return type:int
query_scheme

Required property for query scheme.

Returns:The scheme the query needs
Return type:str
query_path

Required property for the query path.

Returns:The path the query needs
Return type:str
parse(response)[source]

Required first level page parser.

Parameters:response (scrapy.Request) – The response instance from start_requests
Returns:Yields additional scrapy requests
Return type:list[scrapy.Request]