add mp3 support for RJ
This commit is contained in:
parent
042e6581cb
commit
6403be9611
@ -690,7 +690,8 @@
|
|||||||
- **radiocanada**
|
- **radiocanada**
|
||||||
- **RadioCanadaAudioVideo**
|
- **RadioCanadaAudioVideo**
|
||||||
- **radiofrance**
|
- **radiofrance**
|
||||||
- **RadioJavan**
|
- **RadioJavanMp3**
|
||||||
|
- **RadioJavanVideo**
|
||||||
- **Rai**
|
- **Rai**
|
||||||
- **RaiPlay**
|
- **RaiPlay**
|
||||||
- **RaiPlayLive**
|
- **RaiPlayLive**
|
||||||
|
@ -886,7 +886,10 @@ from .radiocanada import (
|
|||||||
RadioCanadaAudioVideoIE,
|
RadioCanadaAudioVideoIE,
|
||||||
)
|
)
|
||||||
from .radiode import RadioDeIE
|
from .radiode import RadioDeIE
|
||||||
from .radiojavan import RadioJavanIE
|
from .radiojavan import (
|
||||||
|
RadioJavanVideoIE,
|
||||||
|
RadioJavanMp3IE,
|
||||||
|
)
|
||||||
from .radiobremen import RadioBremenIE
|
from .radiobremen import RadioBremenIE
|
||||||
from .radiofrance import RadioFranceIE
|
from .radiofrance import RadioFranceIE
|
||||||
from .rai import (
|
from .rai import (
|
||||||
|
@ -10,44 +10,23 @@ from ..utils import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class RadioJavanIE(InfoExtractor):
|
class RadioJavanBaseIE(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',
|
|
||||||
'info_dict': {
|
|
||||||
'id': 'chaartaar-ashoobam',
|
|
||||||
'ext': 'mp4',
|
|
||||||
'title': 'Chaartaar - Ashoobam',
|
|
||||||
'thumbnail': r're:^https?://.*\.jpe?g$',
|
|
||||||
'upload_date': '20150215',
|
|
||||||
'view_count': int,
|
|
||||||
'like_count': int,
|
|
||||||
'dislike_count': int,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
media_id = self._match_id(url)
|
||||||
|
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, media_id)
|
||||||
|
|
||||||
download_host = self._download_json(
|
download_host = self._download_json(
|
||||||
self._HOST_TRACKER_URL,
|
self._HOST_TRACKER_URL,
|
||||||
video_id,
|
media_id,
|
||||||
data=urlencode_postdata({'id': video_id}),
|
data=urlencode_postdata({'id': media_id}),
|
||||||
headers={
|
headers={
|
||||||
'Content-Type': 'application/x-www-form-urlencoded',
|
'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
'Referer': url,
|
'Referer': url,
|
||||||
}
|
}
|
||||||
)['host']
|
)['host']
|
||||||
|
|
||||||
formats = [{
|
formats = self.get_formats(webpage, download_host)
|
||||||
'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)]
|
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
|
||||||
title = self._og_search_title(webpage)
|
title = self._og_search_title(webpage)
|
||||||
@ -68,7 +47,7 @@ class RadioJavanIE(InfoExtractor):
|
|||||||
webpage, 'dislike count', fatal=False))
|
webpage, 'dislike count', fatal=False))
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': media_id,
|
||||||
'title': title,
|
'title': title,
|
||||||
'thumbnail': thumbnail,
|
'thumbnail': thumbnail,
|
||||||
'upload_date': upload_date,
|
'upload_date': upload_date,
|
||||||
@ -77,3 +56,52 @@ class RadioJavanIE(InfoExtractor):
|
|||||||
'dislike_count': dislike_count,
|
'dislike_count': dislike_count,
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class RadioJavanVideoIE(RadioJavanBaseIE):
|
||||||
|
_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',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'chaartaar-ashoobam',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'Chaartaar - Ashoobam',
|
||||||
|
'thumbnail': r're:^https?://.*\.jpe?g$',
|
||||||
|
'upload_date': '20150215',
|
||||||
|
'view_count': int,
|
||||||
|
'like_count': int,
|
||||||
|
'dislike_count': int,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def get_formats(self, webpage, download_host):
|
||||||
|
return [{
|
||||||
|
'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)]
|
||||||
|
|
||||||
|
|
||||||
|
class RadioJavanMp3IE(RadioJavanBaseIE):
|
||||||
|
_VALID_URL = r'https?://(?:www\.)?radiojavan\.com/mp3s/mp3/(?P<id>[^/?]+)/?'
|
||||||
|
_HOST_TRACKER_URL = 'https://www.radiojavan.com/mp3s/mp3_host'
|
||||||
|
_TEST = {
|
||||||
|
'url': 'https://www.radiojavan.com/mp3s/mp3/Mazyar-Fallahi-Baran-Fallahi-Begoo-Boro',
|
||||||
|
'md5': '9601a5a94ced3a2f772f8d18170a8920',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'Mazyar-Fallahi-Baran-Fallahi-Begoo-Boro',
|
||||||
|
'ext': 'mp3',
|
||||||
|
'title': 'Mazyar Fallahi & Baran Fallahi - Begoo Boro',
|
||||||
|
'thumbnail': r're:^https?://.*\.jpe?g$',
|
||||||
|
'upload_date': '20180729',
|
||||||
|
'view_count': int,
|
||||||
|
'like_count': int,
|
||||||
|
'dislike_count': int,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def get_formats(self, webpage, download_host):
|
||||||
|
mp3_path = re.findall(r"RJ\.currentMP3Url\s*=\s*'/?([^']+)'", webpage)[0]
|
||||||
|
return [{'url': '%s/media/%s.mp3' % (download_host, mp3_path)}]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user