use stricter file selector

in case of empty in case of empty ./track/video/file entries
This commit is contained in:
Peter Rowlands 2016-05-08 10:02:48 +09:00
parent 3452c3a27c
commit 370d4eb8ad

View file

@ -95,7 +95,7 @@ def _real_extract(self, url):
thumbnail = xpath_text(video_xml, './track/titleImage', 'thumbnail') thumbnail = xpath_text(video_xml, './track/titleImage', 'thumbnail')
entries = [] entries = []
for i, video_file in enumerate(video_xml.findall('./track/video/file')): for i, video_file in enumerate(video_xml.findall('./track/video/file[@key]')):
video_key = self.parse_video_key(video_file.get('key')) video_key = self.parse_video_key(video_file.get('key'))
entries.append({ entries.append({
'id': '%s_%s' % (video_id, video_key.get('part', i + 1)), 'id': '%s_%s' % (video_id, video_key.get('part', i + 1)),
@ -119,7 +119,7 @@ def _real_extract(self, url):
info['entries'] = entries info['entries'] = entries
elif len(entries) == 1: elif len(entries) == 1:
info['url'] = entries[0]['url'] info['url'] = entries[0]['url']
info['upload_date'] = entries[0]['upload_date'] info['upload_date'] = entries[0].get('upload_date')
else: else:
raise ExtractorError( raise ExtractorError(
'No files found for the specified AfreecaTV video, either' 'No files found for the specified AfreecaTV video, either'