summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSergey M․ <[email protected]>2017-01-19 04:49:31 +0700
committerSergey M․ <[email protected]>2017-01-19 04:49:31 +0700
commiteb3f008c9e686f38c50511004d5c9a51b2e8cdd2 (patch)
treeb1a5b002fb090c0599c95ba0e224cbb9fcce494f
parentf1e70fc2ff6f1536873ed73ffc9bff63653fd5ca (diff)
downloadyoutube-dl-eb3f008c9e686f38c50511004d5c9a51b2e8cdd2.tar.gz
youtube-dl-eb3f008c9e686f38c50511004d5c9a51b2e8cdd2.zip
[uol] Fix extraction (closes #11770)
-rw-r--r--youtube_dl/extractor/uol.py27
1 files changed, 21 insertions, 6 deletions
diff --git a/youtube_dl/extractor/uol.py b/youtube_dl/extractor/uol.py
index c27c64387..e67083004 100644
--- a/youtube_dl/extractor/uol.py
+++ b/youtube_dl/extractor/uol.py
@@ -84,12 +84,27 @@ class UOLIE(InfoExtractor):
def _real_extract(self, url):
video_id = self._match_id(url)
- if not video_id.isdigit():
- embed_page = self._download_webpage('https://jsuol.com.br/c/tv/uol/embed/?params=[embed,%s]' % video_id, video_id)
- video_id = self._search_regex(r'mediaId=(\d+)', embed_page, 'media id')
+ media_id = None
+
+ if video_id.isdigit():
+ media_id = video_id
+
+ if not media_id:
+ embed_page = self._download_webpage(
+ 'https://jsuol.com.br/c/tv/uol/embed/?params=[embed,%s]' % video_id,
+ video_id, 'Downloading embed page', fatal=False)
+ if embed_page:
+ media_id = self._search_regex(
+ (r'uol\.com\.br/(\d+)', r'mediaId=(\d+)'),
+ embed_page, 'media id', default=None)
+
+ if not media_id:
+ webpage = self._download_webpage(url, video_id)
+ media_id = self._search_regex(r'mediaId=(\d+)', webpage, 'media id')
+
video_data = self._download_json(
- 'http://mais.uol.com.br/apiuol/v3/player/getMedia/%s.json' % video_id,
- video_id)['item']
+ 'http://mais.uol.com.br/apiuol/v3/player/getMedia/%s.json' % media_id,
+ media_id)['item']
title = video_data['title']
query = {
@@ -118,7 +133,7 @@ class UOLIE(InfoExtractor):
tags.append(tag_description)
return {
- 'id': video_id,
+ 'id': media_id,
'title': title,
'description': clean_html(video_data.get('desMedia')),
'thumbnail': video_data.get('thumbnail'),