aboutsummaryrefslogtreecommitdiffstats
path: root/youtube_dl/extractor/lnkgo.py
diff options
context:
space:
mode:
authorNaglis Jonaitis <njonaitis@gmail.com>2015-01-14 00:51:48 +0200
committerNaglis Jonaitis <njonaitis@gmail.com>2015-01-14 00:51:48 +0200
commitf2cbc96c3ea3f0c3b447b50b445de736e535d63f (patch)
treeb7d90087bb401b87fcc033d43c760fe64f80cfb2 /youtube_dl/extractor/lnkgo.py
parenta69801e2c6f53985acf475f391f7f7205775d631 (diff)
downloadyoutube-dl-f2cbc96c3ea3f0c3b447b50b445de736e535d63f.zip
youtube-dl-f2cbc96c3ea3f0c3b447b50b445de736e535d63f.tar.gz
youtube-dl-f2cbc96c3ea3f0c3b447b50b445de736e535d63f.tar.bz2
[lnkgo] Make more robust
Diffstat (limited to 'youtube_dl/extractor/lnkgo.py')
-rw-r--r--youtube_dl/extractor/lnkgo.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/youtube_dl/extractor/lnkgo.py b/youtube_dl/extractor/lnkgo.py
index cfae601..a8e3578 100644
--- a/youtube_dl/extractor/lnkgo.py
+++ b/youtube_dl/extractor/lnkgo.py
@@ -62,16 +62,18 @@ class LnkGoIE(InfoExtractor):
title = self._og_search_title(webpage)
description = self._og_search_description(webpage)
- thumbnail = self._og_search_thumbnail(webpage)
thumbnail_w = int_or_none(
self._og_search_property('image:width', webpage, 'thumbnail width', fatal=False))
thumbnail_h = int_or_none(
self._og_search_property('image:height', webpage, 'thumbnail height', fatal=False))
- thumbnails = [{
- 'url': thumbnail,
- 'width': thumbnail_w,
- 'height': thumbnail_h,
- }]
+ thumbnail = {
+ 'url': self._og_search_thumbnail(webpage),
+ }
+ if thumbnail_w and thumbnail_h:
+ thumbnail.update({
+ 'width': thumbnail_w,
+ 'height': thumbnail_h,
+ })
upload_date = unified_strdate(self._search_regex(
r'class="meta-item\sair-time">.*?<strong>([^<]+)</strong>', webpage, 'upload date', fatal=False))
@@ -80,7 +82,7 @@ class LnkGoIE(InfoExtractor):
pg_rating = self._search_regex(
r'pgrating="([^"]+)"', webpage, 'PG rating', fatal=False, default='')
- age_limit = self._AGE_LIMITS.get(pg_rating, 0)
+ age_limit = self._AGE_LIMITS.get(pg_rating.upper(), 0)
sources_js = self._search_regex(
r'(?s)sources:\s(\[.*?\]),', webpage, 'sources')
@@ -114,7 +116,7 @@ class LnkGoIE(InfoExtractor):
'display_id': display_id,
'title': title,
'formats': formats,
- 'thumbnails': thumbnails,
+ 'thumbnails': [thumbnail],
'duration': duration,
'description': description,
'age_limit': age_limit,