Browse Source

[turner,cnn] move a check for wrong timestamp to CNNIE

totalwebcasting
Remita Amine 8 years ago
parent
commit
da30a20a4d
2 changed files with 8 additions and 5 deletions
  1. +4
    -0
      youtube_dl/extractor/cnn.py
  2. +4
    -5
      youtube_dl/extractor/turner.py

+ 4
- 0
youtube_dl/extractor/cnn.py View File

@ -83,6 +83,10 @@ class CNNIE(TurnerBaseIE):
}, },
} }
def _extract_timestamp(self, video_data):
# TODO: fix timestamp extraction
return None
def _real_extract(self, url): def _real_extract(self, url):
sub_domain, path, page_title = re.match(self._VALID_URL, url).groups() sub_domain, path, page_title = re.match(self._VALID_URL, url).groups()
if sub_domain not in ('money', 'edition'): if sub_domain not in ('money', 'edition'):


+ 4
- 5
youtube_dl/extractor/turner.py View File

@ -17,6 +17,9 @@ from ..utils import (
class TurnerBaseIE(InfoExtractor): class TurnerBaseIE(InfoExtractor):
def _extract_timestamp(self, video_data):
return int_or_none(xpath_attr(video_data, 'dateCreated', 'uts'))
def _extract_cvp_info(self, data_src, video_id, path_data={}): def _extract_cvp_info(self, data_src, video_id, path_data={}):
video_data = self._download_xml(data_src, video_id) video_data = self._download_xml(data_src, video_id)
video_id = video_data.attrib['id'].split('/')[-1].split('.')[0] video_id = video_data.attrib['id'].split('/')[-1].split('.')[0]
@ -159,10 +162,6 @@ class TurnerBaseIE(InfoExtractor):
'height': int_or_none(image.get('height')), 'height': int_or_none(image.get('height')),
} for image in video_data.findall('images/image')] } for image in video_data.findall('images/image')]
timestamp = None
if 'cnn.com' not in data_src:
timestamp = int_or_none(xpath_attr(video_data, 'dateCreated', 'uts'))
return { return {
'id': video_id, 'id': video_id,
'title': title, 'title': title,
@ -171,7 +170,7 @@ class TurnerBaseIE(InfoExtractor):
'thumbnails': thumbnails, 'thumbnails': thumbnails,
'description': xpath_text(video_data, 'description'), 'description': xpath_text(video_data, 'description'),
'duration': parse_duration(xpath_text(video_data, 'length') or xpath_text(video_data, 'trt')), 'duration': parse_duration(xpath_text(video_data, 'length') or xpath_text(video_data, 'trt')),
'timestamp': timestamp,
'timestamp': self._extract_timestamp(video_data),
'upload_date': xpath_attr(video_data, 'metas', 'version'), 'upload_date': xpath_attr(video_data, 'metas', 'version'),
'series': xpath_text(video_data, 'showTitle'), 'series': xpath_text(video_data, 'showTitle'),
'season_number': int_or_none(xpath_text(video_data, 'seasonNumber')), 'season_number': int_or_none(xpath_text(video_data, 'seasonNumber')),


Loading…
Cancel
Save