aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl
diff options
context:
space:
mode:
authorAndrás Veres-Szentkirályi <vsza@vsza.hu>2018-05-25 19:46:05 +0200
committerSergey M <dstftw@gmail.com>2018-05-26 00:46:05 +0700
commitb39f42ee92a3cd669da24db9798e1dc9b574720f (patch)
treee9cd3321dfceb521e33a1298e2bd273fbdf19b9d /youtube_dl
parent6bd499e8ca769cf69c4b24fa2d7a751d7869b679 (diff)
[indavideo] Sign download URLs
Diffstat (limited to 'youtube_dl')
-rw-r--r--youtube_dl/extractor/indavideo.py23
1 files changed, 18 insertions, 5 deletions
diff --git a/youtube_dl/extractor/indavideo.py b/youtube_dl/extractor/indavideo.py
index 11cf3c609..15b766fb2 100644
--- a/youtube_dl/extractor/indavideo.py
+++ b/youtube_dl/extractor/indavideo.py
@@ -2,10 +2,12 @@
from __future__ import unicode_literals
from .common import InfoExtractor
+from ..compat import compat_str
from ..utils import (
int_or_none,
parse_age_limit,
parse_iso8601,
+ update_url_query,
)
@@ -58,11 +60,10 @@ class IndavideoEmbedIE(InfoExtractor):
if flv_url not in video_urls:
video_urls.append(flv_url)
- formats = [{
- 'url': video_url,
- 'height': int_or_none(self._search_regex(
- r'\.(\d{3,4})\.mp4(?:\?|$)', video_url, 'height', default=None)),
- } for video_url in video_urls]
+ filesh = video.get('filesh')
+ formats = [
+ self.video_url_to_format(video_url, filesh)
+ for video_url in video_urls]
self._sort_formats(formats)
timestamp = video.get('date')
@@ -90,6 +91,18 @@ class IndavideoEmbedIE(InfoExtractor):
'formats': formats,
}
+ def video_url_to_format(self, video_url, filesh):
+ height = int_or_none(self._search_regex(
+ r'\.(\d{3,4})\.mp4(?:\?|$)', video_url, 'height', default=None))
+ if height and filesh:
+ token = filesh.get(compat_str(height))
+ if token is not None:
+ video_url = update_url_query(video_url, {'token': token})
+ return {
+ 'url': video_url,
+ 'height': height,
+ }
+
class IndavideoIE(InfoExtractor):
_VALID_URL = r'https?://(?:.+?\.)?indavideo\.hu/video/(?P<id>[^/#?]+)'