I'm currently trying to access last.fm's API using a simple GET request. The best NPM library I found was last-fm by feross. The problem is that my request keeps timing out and I don't get any errors. Is meteor causing this?
My request URL is: https://ws.audioscrobbler.com:3000/2.0/?method=artist.getInfo&artist=cher&autocorrect=1&api_key=MY_API_KEY&format=json
Here is the code.
import LastFM from 'last-fm';
const lastfm = new LastFM("476f055645b6f0dae156fdf54d006bec", {userAgent: "buildsmoothie (BringItBird.Com v0.1) (jawszone@gmail.com)"})
export const ArtistCheck = () => {
lastfm.artistInfo({ name: "cher" }, (err, data) => {
if (err) console.log(err)
else console.log(data)
})
}
And then I call it in another component here:
artistGateCheck(e){
e.preventDefault();
ArtistCheck();
}
via John
No comments:
Post a Comment