python - error 400 - bad request when trying to set q search parameter in Soundcloud with Scrapy item -
im trying search soundcloud track related artists name. works if type artist name in q search parameter, want use item ['artist'] variable. think theres prbably simple programming error causing 'bad request' error. here relevant code. guys!!
def parse_me(self, response): info in response.xpath('//div[@class="entry vevent"]'): item = tutorialitem() # extract items items folder. item ['artist'] = info.xpath('.//span[@class="summary"]//text()').extract() # extract artist information. #item ['genre'] = info.xpath('.//div[@class="header"]//text()').extract() yield item # retreive items in item client = soundcloud.client(client_id='xxxx', client_secret='xxxx', callback='http://localhost:9000/#/callback.html') tracks = client.get('/tracks', q=item['artist'], limit=1) track in tracks: print track.id item ['trackz'] = track.id yield item
info.xpath('.//span[@class="summary"]//text()').extract()
returns list. q
parameter requires string.