View Source YaBTTWeb.Controllers.Scrape (YaBTT v0.1.5)

A Plug to handle route /scrape.

The original BitTorrent Protocol Specification defines one exchange between a client and a tracker referred to as an announce. In order to build responsive user interfaces, clients desired an additional way to query metadata about swarms in bulk. The exchange that fetches this metadata for the clients is referred to as a scrape.

It should be noted that scrape exchanges have no effect on a peer's participation in a swarm.

Learn more about Tracker Protocol Extension: Scrape.

examples

Examples

For reference, we have prepared a more detailed actual cases of call routing /scrape.

scrape-request

Scrape Request

The query string should be like:

info_hash=Nf%22v%BA%CA%0F%DBk%D6%0Bv%17%8C%D1%19%D1%05%00%13&info_hash=%124Vx%9A%BC%DE%F1%23Eg%89%AB%CD%EF%124Vx%9A

Notice that the info_hash need to be encoded to RFC1738.

scrape-response

Scrape Response

The response to a successful request is a bencoded dictionary containing one key-value pair: the key files with the value being a dictionary of the 20-byte string representation of an infohash paired with a dictionary of swarm metadata. The fields found in the swarm metadata dictionary are as follows:

  • complete - The number of active peers that have completed downloading.
  • incomplete - The number of active peers that have not completed downloading.
  • downloaded - The number of peers that have ever completed downloading.

Link to this section Summary

Functions

The main entry point for the plug.

Initializes the plug.

Link to this section Functions

@spec call(Plug.Conn.t(), Plug.opts()) :: Plug.Conn.t()

The main entry point for the plug.

@spec init(Plug.opts()) :: Plug.opts()

Initializes the plug.