Question

import elementtree.ElementTree as ET
import urllib  

name = name.lower().replace(' ','%20')
id_search = 'http://services.tvrage.com/myfeeds/search.php?key=ag6txjP0RH4m0c8sZk2j&show='+name
tree = ET.parse(urllib.urlopen(id_search))
root = tree.getroot()
showid = root.find('showid')
url = 'http://services.tvrage.com/myfeeds/episode_list.php?key=ag6txjP0RH4m0c8sZk2j&sid='+str(showid)

For some reason the showid comes up as none. Any help on this would be great. I'm using this on xbmc addon to scrape the showid.

Here is the link http://services.tvrage.com/myfeeds/search.php?key=ag6txjP0RH4m0c8sZk2j&show=black%20sails

Was it helpful?

Solution

The root-element of the xml-file is the results-element, only containing show-elements. You're trying to take subelement show-id from results, while show-id-elements are all subelements of show.

You could use showid = root.find('show/show-id'), but probably you want toe use a for-loop and the findall-function instead of the find-function.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top