whatcd

2.1.0 • Public • Published

What.CD

Simple, idiomatic access to the API features of What.CD.

Overview

What.CD provides a JSON API to registered users. This library aims to maintain coverage of all features within a reasonable timeframe and provide an easy to use and obvious surface.

This should also work on other Gazelle-based websites, but will be tested with what.cd only.

Installation

npm install whatcd

OR

git clone git://github.com/deoxxa/whatcd.git

Example

var WhatCD = require("whatcd");
 
var client = new WhatCD("https://what.cd", "username", "password");
 
client.index(function(err, data) {
  if (err) {
    return console.log(err);
  }
 
  console.log(data);
});

Usage

client.METHOD([PARAMETERS,] function(err, data) {
  ...
});

METHOD is one of the methods below and PARAMETERS is an object that maps directly to URL parameters in the request to the website. For more information, see this article. You will need to be logged in to view it.

There's also an api_request method that automatically handles login and such, and is in fact what all the rest of these methods are built upon. You can use it to make arbitrary requests to the website while ensuring that the correct steps have been taken to ensure that you're authenticated.

client.api_request(PARAMETERS, function(err, data) {
  ...
});

PARAMETERS is the same as before, where each property maps to a query string parameter. To request the index, for example, you would do this:

client.api_request({action: "index"}, function(err, data) {
  ...
});

This is exactly how all the methods listed below operate under the hood.

Available Methods

  • announcements
  • artist
  • bookmarks
  • bookmarks_artists (or bookmarksArtists)
  • bookmarks_torrents (or bookmarksTorrents)
  • browse
  • forum_main (or forumMain)
  • forum_viewforum (or forumViewForum)
  • forum_viewthread (or forumViewThread)
  • inbox
  • inbox_inbox (or inboxInbox)
  • inbox_sentbox (or inboxSentbox)
  • inbox_viewconv (or inboxViewconv)
  • index
  • notifications
  • request
  • requests
  • similar_artists
  • subscriptions
  • top10
  • top10_tags (or top10Tags)
  • top10_torrents (or top10Torrents)
  • top10_users (or top10Users)
  • torrent
  • torrentgroup
  • user
  • usersearch

License

3-clause BSD. A copy is included with the source.

Contact

Readme

Keywords

none

Package Sidebar

Install

npm i whatcd

Weekly Downloads

2

Version

2.1.0

License

BSD

Last publish

Collaborators

  • deoxxa