[nba] use xpath utils

This commit is contained in:
remitamine 2015-12-04 07:09:48 +01:00
parent 6a11bb77ba
commit 46cc1c65a4

View file

@ -6,6 +6,8 @@ from .common import InfoExtractor
from ..utils import (
parse_duration,
int_or_none,
xpath_text,
xpath_attr,
)
@ -43,11 +45,11 @@ class NBAIE(InfoExtractor):
def _real_extract(self, url):
path, video_id = re.match(self._VALID_URL, url).groups()
video_info = self._download_xml('http://www.nba.com/%s.xml' % path, video_id)
video_id = video_info.find('slug').text
title = video_info.find('headline').text
description = video_info.find('description').text
duration = parse_duration(video_info.find('length').text)
timestamp = int_or_none(video_info.find('dateCreated').attrib.get('uts'))
video_id = xpath_text(video_info, 'slug')
title = xpath_text(video_info, 'headline')
description = xpath_text(video_info, 'description')
duration = parse_duration(xpath_text(video_info, 'length'))
timestamp = int_or_none(xpath_attr(video_info, 'dateCreated', 'uts'))
thumbnails = []
for image in video_info.find('images'):