last.fm

Last.fm api invalid method

╄→尐↘猪︶ㄣ 提交于 2019-12-07 21:50:39
问题 I am trying to write a python script to do a query to Last.fm, but I keep getting an invalid method error returned. I don't want links to pre-written last.fm python libraries, I am trying to do this as a "test what I know" kind of project. Thanks in advance! import urllib import httplib params = urllib.urlencode({'method' : 'artist.getsimilar', 'artist' : 'band', 'limit' : '5', 'api_key' : #API key goes here}) header = {"user-agent" : "myapp/1.0"} lastfm = httplib.HTTPConnection("ws

Last.fm api invalid method

你。 提交于 2019-12-06 05:23:55
I am trying to write a python script to do a query to Last.fm, but I keep getting an invalid method error returned. I don't want links to pre-written last.fm python libraries, I am trying to do this as a "test what I know" kind of project. Thanks in advance! import urllib import httplib params = urllib.urlencode({'method' : 'artist.getsimilar', 'artist' : 'band', 'limit' : '5', 'api_key' : #API key goes here}) header = {"user-agent" : "myapp/1.0"} lastfm = httplib.HTTPConnection("ws.audioscrobbler.com") lastfm.request("POST","/2.0/?",params,header) response = lastfm.getresponse() print

jQuery + get.JSON + Last.FM problems

╄→尐↘猪︶ㄣ 提交于 2019-12-04 15:28:06
I am trying to customize this script so that instead of a user's recent tracks it will display a user's favourite artists. This is what I have come up with, however it doesn't work whatsoever. I thought it would be easy changing the attributes of the feed, but obviously not... (function($){ $.fn.lastFM = function(options) { var defaults = { number: 10, username: 'willblackmore', apikey: '96e0589327a3f120074f74dbc8ec6443', artSize: 'medium', noart: 'images/noartwork.gif', onComplete: function(){} }, settings = $.extend({}, defaults, options); var lastUrl = 'http://ws.audioscrobbler.com/2.0/

Creating/Accessing a JSON object using jQuery $.ajax with Last.FM API

被刻印的时光 ゝ 提交于 2019-11-30 15:15:24
I've recently changed my site design and now need to use dynamic AJAX requests for my data. Basically, I'm trying to retrieve user data using the Last.FM API in JSON format. I'm newish to this, particularly JSON, and it's giving me a bit of a headache! I know I must be missing something simple. Here is some very basic code to test the functionality but it's not retrieving anything! <html> <head> <script src="./jquery/jquery-1.4.4.js"></script> </head> <body> <script type="text/javascript"> $(document).ready(function() { $.getJSON("http://ws.audioscrobbler.com/2.0/?method=user.getTopArtists

PHP cURL error: “Empty reply from server”

ぐ巨炮叔叔 提交于 2019-11-30 07:39:26
I have a class function to interface with the RESTful API for Last.FM - its purpose is to grab the most recent tracks for my user. Here it is: private static $base_url = 'http://ws.audioscrobbler.com/2.0/'; public static function getTopTracks($options = array()) { $options = array_merge(array( 'user' => 'bachya', 'period' => NULL, 'api_key' => 'xxxxx...', // obfuscated, obviously ), $options); $options['method'] = 'user.getTopTracks'; // Initialize cURL request and set parameters $ch = curl_init(); curl_setopt_array($ch, array( CURLOPT_URL => self::$base_url, CURLOPT_POST => TRUE, CURLOPT

Creating/Accessing a JSON object using jQuery $.ajax with Last.FM API

巧了我就是萌 提交于 2019-11-29 22:04:52
问题 I've recently changed my site design and now need to use dynamic AJAX requests for my data. Basically, I'm trying to retrieve user data using the Last.FM API in JSON format. I'm newish to this, particularly JSON, and it's giving me a bit of a headache! I know I must be missing something simple. Here is some very basic code to test the functionality but it's not retrieving anything! <html> <head> <script src="./jquery/jquery-1.4.4.js"></script> </head> <body> <script type="text/javascript"> $

XML parsing in java with xpath

笑着哭i 提交于 2019-11-29 17:26:53
I am trying to print out some data so my code is private static final DocumentBuilderFactory DOCUMENT_BUILDER_FACTORY = DocumentBuilderFactory.newInstance(); private static final XPathFactory XPATH_FACTORY = XPathFactory.newInstance(); public void parseXml(String urlPath) throws Exception { URL url = new URL(urlPath); URLConnection connection = url.openConnection(); DocumentBuilder db = DOCUMENT_BUILDER_FACTORY.newDocumentBuilder(); final Document document = db.parse(connection.getInputStream()); XPath xPathEvaluator = XPATH_FACTORY.newXPath(); XPathExpression nameExpr = xPathEvaluator.compile

PHP cURL error: “Empty reply from server”

喜你入骨 提交于 2019-11-29 03:27:08
问题 I have a class function to interface with the RESTful API for Last.FM - its purpose is to grab the most recent tracks for my user. Here it is: private static $base_url = 'http://ws.audioscrobbler.com/2.0/'; public static function getTopTracks($options = array()) { $options = array_merge(array( 'user' => 'bachya', 'period' => NULL, 'api_key' => 'xxxxx...', // obfuscated, obviously ), $options); $options['method'] = 'user.getTopTracks'; // Initialize cURL request and set parameters $ch = curl

ElementTree findall() returning empty list

自作多情 提交于 2019-11-28 08:59:53
I am trying to write a small script for interacting with the last.fm API. I have a small bit of experience working with ElementTree , but the way I used it previously doesn't seem to be working, it instead returns an empty list. I removed the API key as I don't know exactly how private it should be, and gave an example of the XML I am receiving in it's place. Class for interacting with API: from xml.etree import ElementTree import urllib import urllib2 class Last_fmWrapper(object): def __init__(self): self.last_fm_api_key = '*****************************' self.api_url = 'http://ws