def parse_movie xml Parse XML fetched from IMDB trynt com service node

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
def parse_movie(xml):
"""
Parse XML fetched from IMDB trynt.com service.
"""
node = {}
tree = ET.fromstring(xml)
data = tree.find('Movie-IMDB-Details').find('IMDB-Data')
try:
picture_url = data.find('Picture-URL').text
except AttributeError:
picture_url = None
node['Picture-URL'] = picture_url
return node