mirror of
https://github.com/Wan-Video/Wan2.1.git
synced 2025-07-14 11:40:10 +00:00
21 lines
485 B
CoffeeScript
21 lines
485 B
CoffeeScript
Promise = require('bluebird')
|
|
request = require('request')
|
|
|
|
home = 'http://tothebestof.com/'
|
|
regex = /songIDs\=(\d*\,)*\d*/
|
|
|
|
# Attach to methods obj
|
|
module.exports = (obj) ->
|
|
obj.getBestOf = (artist) ->
|
|
deferred = Promise.defer()
|
|
|
|
options =
|
|
url: home + artist
|
|
|
|
request options, (err, res, body) ->
|
|
if err then return deferred.reject err
|
|
ids = body.match(regex)[0][8..].split ','
|
|
deferred.resolve(obj.getSongInfo(ids))
|
|
|
|
return deferred.promise
|