aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/pinkbike.py
diff options
context:
space:
mode:
authorMister Hat <misterhat144@gmail.com>2015-05-24 16:45:10 -0500
committerMister Hat <misterhat144@gmail.com>2015-05-24 16:45:10 -0500
commit680f9744c4e010ad5111c7711c58c341d5ba24dd (patch)
tree1100b9a66b3a363439a4e5bfb6d48968a33923e3 /youtube_dl/extractor/pinkbike.py
parent2c935c0c7224a3332ff9f0fd83e8c074cfbe2c9d (diff)
[pinkbike] used proper conversion methods
Diffstat (limited to 'youtube_dl/extractor/pinkbike.py')
-rw-r--r--youtube_dl/extractor/pinkbike.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/youtube_dl/extractor/pinkbike.py b/youtube_dl/extractor/pinkbike.py
index 66605ddbe..45c0b1377 100644
--- a/youtube_dl/extractor/pinkbike.py
+++ b/youtube_dl/extractor/pinkbike.py
@@ -4,6 +4,11 @@ from __future__ import unicode_literals
import re
from .common import InfoExtractor
+from ..utils import (
+ int_or_none,
+ remove_end,
+ remove_start
+)
class PinkbikeIE(InfoExtractor):
@@ -43,10 +48,13 @@ class PinkbikeIE(InfoExtractor):
webpage = self._download_webpage(url, video_id)
title = self._html_search_regex(r'<title>(.*?)</title>', webpage, 'title')
- title = title[:-len(' Video - Pinkbike')]
+ title = remove_end(title, ' Video - Pinkbike')
description = self._html_search_meta('description', webpage, 'description')
- description = description[len(title + '. '):]
+ description = remove_start(description, title + '. ')
+
+ duration = int_or_none(self._html_search_meta(
+ 'video:duration', webpage, 'duration'))
uploader_id = self._html_search_regex(r'un:\s*"(.*?)"', webpage, 'uploader_id')
@@ -63,13 +71,13 @@ class PinkbikeIE(InfoExtractor):
r'<source data-quality=\\"([0-9]+)p\\" src=\\"(.*?)\\">',
webpage)
- formats = [{'url': fmt[1], 'height': fmt[0]} for fmt in formats]
+ formats = [{'url': fmt[1], 'height': int_or_none(fmt[0])} for fmt in formats]
return {
'id': video_id,
'title': title,
'description': description,
- 'duration': int(self._html_search_meta('video:duration', webpage, 'duration')),
+ 'duration': duration,
'thumbnail': self._html_search_meta('og:image', webpage, 'thumbnail'),
'uploader_id': uploader_id,
'upload_date': upload_date,