Wan2.1/web_interface/node_modules/gradio/source/plugins/bestof.coffee
2025-05-17 10:46:44 +00:00

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