This is a JavaScript wrapper for the yts.to API that returns promises.
Calls to the classes methods return promises. All API functionality is wrapped. The parameters for the methods are the mandatory fields. Where optional fields may be passed this may be done via options object. For optional parameters please refer to the yts.to API documentation. JSON is returned directly as the API returns it. The interesting content is in the data field of the response.
npm install yts.to --save
var YTS = require('yts.to');
var yts = new YTS();
yts.findMovie('Snatch', {with_rt_ratings: true}).then( function(movies) {
console.log(movies);
});
The YTS class provides the following methods:
- findMovie(searchString, options = {})
- getDetails(movieId, options = {})
- getSuggestions(movieId)
- getComments(movieId)
- getReviews(movieId)
- getParentalGuides(movieId)
- getUpcoming()
- getUserDetails(userId, options = {})
- getUserKey(username, password, applicationId)
- getUserProfile(userKey)
- editUserSettings(userKey, applicationKey, options = {})
- registerUser(applicationKey, username, password, email)
- forgotPassword(applicationKey, email)
- resetPassword(resetCode, newPassword, applicationKey)
- likeMovie(userKey, movieId, applicationKey)
- getBookmarks(userKey, options = {})
- addBookmark(userKey, movieId, applicationKey)
- deleteBookmark(userKey, movieId, applicationKey)
- makeComment(userKey, movieId, commentText, applicationKey)
- likeComment(userKey, commentId, applicationKey)
- reportComment(userKey, commentId, applicationKey)
- deleteComment(userKey, commentId, applicationKey)
- makeRequest(userKey, movieTitle, applicationKey, options = {})
An extensive test suite is provided and may be invoked by running:
npm run test