Skip to content

Latest commit

 

History

History
67 lines (48 loc) · 2 KB

README.md

File metadata and controls

67 lines (48 loc) · 2 KB

Scraping Server

This server listens to requests for cover art and similarity information and answers with the results of a scrape engine, like the scrape engine for last.fm.

Usage

# Install the dependencies
npm install

# Run the server on localhost:8080
node index.js

Authenticate users

To access the scraping server, users have to authenticate themselves against the server with a URL that looks like this: web+peermusic://SCRAPING#host:port#user-id#secret-key

  • Add a new user: node authenticate.js add <Description of the user>
  • List all currently authenticated users: node authenticate.js list
  • Remove the access of a user: node authenticate.js remove <ID of the user>

Endpoints

The scraping server offers multiple endpoints to provide different pices of information. All endpoints expect a encrypted message as a request and return an encrypted message. The format follows the messages generated by the secure client-to-server messaging encrypt & decrypt functions.

/Cover

This endpoint returns the cover art of a given payload.

Expected request payload: JSON object with album and optional artist set

Response payload: Base64-encoded image data of the cover art

/similarTrack

This endpoint returns similar tracks to the given payload.

Expected request payload: JSON object with the keys of one of the following formats set

  • title, album (optional) and artist (optional)
  • album and artist (optional)
  • artist
  • genre

Reponse payload: JSON object in the following format

{
  "payload": {
    // initial request payload 
  },
  "result": [
    {
      // title, album and artist are always set
      // track, year and genre are optional
      "title": "Celebration Day",
      "album": "Led Zeppelin III",
      "artist": "Led Zeppelin",
      "track": 3,
      "year": 1970,
      "genre": "classic rock"
    },
    // ...
  ]
}