423 Errors and I Couldn’t Be Happier

This new JavaScript & jQuery version of my Python project with the Spotify API continues to go well. The fact that I even began writing big chunks of code between tests and those chunks passed those tests is a real confidence booster. I’ve made significantly more progress with JavaScript than I did with Python (someday, I’ll look further into why).

The Python versions put the results into an HTML table or a list but, for now, I’m just logging results in the console. To get the results in question I’ve built functions and loops to do the following:

  1. Build artistURL using artistID
  2. Use artistURL to request artist JSON
    • Get artist name
    • Get artist popularity
  3. Build artistAlbums URL using artistID
  4. Use artistAlbums URL to request artist’s albums JSON
    • For each album
      1. Get albumID
      2. Build albumURL using albumID
      3. Use albumURL to request album JSON
        • Get album release date
        • Get album popularity
      4. Build albumTracksURL using each albumID
      5. Use albumTracksURL to request album tracks JSON
        • For each track
          1. get each trackID
          2. Build trackURL for each track using trackID
          3. Use trackURL to request track JSON
            • Get track name
            • Get track popularity

Cyber Oddity

One function of my little program gets all albums by an artist. I’ve limited results to “albums” — no singles, no EPs, no compilations. There are still, however, multiple albums per title with different IDs. They have exactly the same title and year so it doesn’t appear to be “deluxe” or “anniversary” editions but I’ll double check that using the URLs appearing in the console later. I’m currently searching through StackOverflow and GitHub (Spotify API repo issues) for other possible answers as to why. The number of “versions,” for lack of a better word, ranges from 1-4 with new albums among those with the most versions (eliminating–I think–the idea that they are re-releases and such).

423 Errors and Learning Dev Tools and Stuff

The first major milestone gave me a motherload of errors that, while puzzling, weren’t frustrating or discouraging. My browser of choice is Firefox Developer Edition:

FireFoxConsole.png

Google didn’t have much on “XML Parsing Error: not well-formed Location” and almost all of the results referred to WordPress problems. One post said the errors weren’t returned when using Chrome or Firefox, so I tried Chromium. Generally, I avoid Chrome–on my Linux laptop, the reason is a dialogue repeatedly pops up asking for passwords and shizzle for a keychain but this made me want to get past my issues:

chromiumConsole.png

First of all, I like that it tells me there are 423 errors. It would be great if told me the total number of lines as well (it might, I’m new to the dev tools in all browsers).

Most of all, I like that it tells me “Too Many Requests” which I think is the actual problem, not anything to do with XML or parsing. My theories and ideas for solving this are:

  • Using my API key to see if I am allowed more requests
  • Using “Get Multiple Tracks” instead of requesting each track individually to dramatically reduce the number of requests. The only problem with that might be that “Get Multiple Tracks” might not return the Track Object and property I want — popularity. The reason I requested each track individually is that “Get An Album’s Tracks” returns only some properties and popularity isn’t among them. On that same note, that’s why I have to use “Get an Album” instead of “Get an Artist’s Albums.” If “Get Multiple Tracks” returns the popularity for each track, I’ll have the results of “Get An Album’s Tracks” (how I get the ID for requesting each track) put the IDs in an array and use that array to “Get Multiple Tracks.” If none of those solutions work, I have other ideas but they’re much less desirable. I want something automated so I can collect data over time for some groovy data viz.
Advertisements

About jotascript

Aiming to please. Seeking to impress.
This entry was posted in APIs, Debugging, Developer Tools, Spotify. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s