fxb / javascript-last.fm-api Goto Github PK
View Code? Open in Web Editor NEWlast.fm API bindings for JavaScript
Home Page: http://lastfm.felixbruns.de/javascript-last.fm-api/
last.fm API bindings for JavaScript
Home Page: http://lastfm.felixbruns.de/javascript-last.fm-api/
Hi @fxb, thanks for the great work with this library! There are numerous open PRs that would be great to merge. In particular, I want to support CommonJS (module.exports) and publish this to npm so the new generation of front-end devs (using browserify and others) can use your library.
I can send a PR for just this issue or you can add me as a maintainer I'll take care of giving this library some much-needed love <3.
I'm having trouble getting playlist.fetch to work, and the documentation on LastFM is scarce. I keep receiving error code 7 "invalid resource", but I can't figure out the correct params because there is no documentation on lastFM API docs. Do you have any example by any chance?
The object for caching is initialized wrong. An object needs to be used instead of an array.
For example in line 53 ff of lasfm.cache.js:
localStorage.setObject(name, []);
use an object initializer:
localStorage.setObject(name, {});
The same problem is within the clear() method.
Explanation:
See the store() method:
/* Store data in this cache with a given expiration time. */
this.store = function(hash, data, expiration){
var object = localStorage.getObject(name);
var time = Math.round(new Date().getTime() / 1000);
object[hash] = {
data : data,
expiration : time + expiration
};
localStorage.setObject(name, object);
};
First, the object is de-serialized into an Array of length 0, thus
object=[]
Then the property "hash" is set. This works because the type Array inherits Object.
The resulting object would look similar to this:
object:Array
- length: 0
- "abc123123...a1234a": {.....}
where "abc123123...a1234a" is the value of the hash variable.
During serialization, the hash property is lost as object is of type array and the length is 0, resulting in lastfm=[] in localStorage.
This is why lastfm={} should be stored in localStorage, making lastfm a json object with the hash values as keys.
It seems like the method user.getPersonalTracks is a typo since there is no such API call.
Is this in fact user.getPersonalTags?
Hey!
Thanks for the very useful code, it's great. I found a small bug.
In getApiSignature at line 832 you're using for(var index in keys). This was causing the functions in my array prototype to be added to the string that is used to build the MD5 hash. Switching it to this (below) fixed it right up. I'd commit a patch or something but I'm no good at git.
for(var i=0; i<keys.length; i++){
var key = keys[i];
string += key + params[key];
}
Hi,
Is there a way to retrieve top tags from an album? I didn't find any method in the library 😞
Lastfm accepts only utf-8 charset.
So replace:
doc.write('<form method="post" action="' + apiUrl + '" id="form">');
to
doc.write('<form method="post" action="' + apiUrl + '" id="form" accept-charset="UTF-8"><input name="iehack" type="hidden" value="☠" />');
thx!
e.g. md5 of Chinese word '你好' should be 7ECA689F0D3389D9DEA66AE112E5CFD7
but current caculated is 52a90a58a24523da1b9d09124b1f3861
The track.scrobble method looks like it should take a session parameter to pass on to signedCall.
Hi,
Great lib! However, the documentation is lacking a bit (maybe a needed update)... I've checked the source and in fact you have implemented several things that require auth, including scrobbling. But the README doesn't reflect this. Also, a small guide and formal documentation would be nice to have, too :)
Cheers,
Rui
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.