diff options
author | Hormoz K <hkheradm@gmail.com> | 2018-08-04 09:47:58 -0400 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2018-09-03 02:53:41 +0700 |
commit | 0a9a8118ce834c206434df04c18187934acbf608 (patch) | |
tree | 93962adda5c21be0fb08148a590c15bc581443ef /youtube_dl/extractor/radiojavan.py | |
parent | 3d08f63dc57f000384703f26b7dcb4b683e18c05 (diff) |
[radiojavan] Fix extraction
Diffstat (limited to 'youtube_dl/extractor/radiojavan.py')
-rw-r--r-- | youtube_dl/extractor/radiojavan.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/youtube_dl/extractor/radiojavan.py b/youtube_dl/extractor/radiojavan.py index a53ad97a5..4124bcd45 100644 --- a/youtube_dl/extractor/radiojavan.py +++ b/youtube_dl/extractor/radiojavan.py @@ -6,11 +6,13 @@ from .common import InfoExtractor from ..utils import ( unified_strdate, str_to_int, + urlencode_postdata, ) class RadioJavanIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?radiojavan\.com/videos/video/(?P<id>[^/]+)/?' + _HOST_TRACKER_URL = 'https://www.radiojavan.com/videos/video_host' _TEST = { 'url': 'http://www.radiojavan.com/videos/video/chaartaar-ashoobam', 'md5': 'e85208ffa3ca8b83534fca9fe19af95b', @@ -31,8 +33,18 @@ class RadioJavanIE(InfoExtractor): webpage = self._download_webpage(url, video_id) + download_host = self._download_json( + self._HOST_TRACKER_URL, + video_id, + data=urlencode_postdata({'id': video_id}), + headers={ + 'Content-Type': 'application/x-www-form-urlencoded', + 'Referer': url, + } + )['host'] + formats = [{ - 'url': 'https://media.rdjavan.com/media/music_video/%s' % video_path, + 'url': '%s/%s' % (download_host, video_path), 'format_id': '%sp' % height, 'height': int(height), } for height, video_path in re.findall(r"RJ\.video(\d+)p\s*=\s*'/?([^']+)'", webpage)] |