1
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)

由于某种原因showid,没有出现。对此的任何帮助都会很棒。我在 xbmc 插件上使用它来抓取 showid。

这是链接http://services.tvrage.com/myfeeds/search.php?key=ag6txjP0RH4m0c8sZk2j&show=black%20sails

4

1 回答 1

0

xml 文件的根元素是-results元素,仅包含-show元素。您试图show-id从中获取子元素results,而show-id-elements 都是show.

您可以使用showid = root.find('show/show-id'),但可能您希望使用 for 循环和 findall-function 而不是 find-function。

于 2014-02-16T15:07:19.377 回答