mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-23 15:51:24 +01:00
Compare commits
7 Commits
a9ed3fea3f
...
f6d459c4e6
Author | SHA1 | Date | |
---|---|---|---|
|
f6d459c4e6 | ||
|
dc2c2f1267 | ||
|
1f13bd5eb1 | ||
|
1db3eaa77e | ||
|
5d01746c4c | ||
|
322acaef8a | ||
|
905672d378 |
|
@ -135,7 +135,10 @@ from .antenna import (
|
||||||
from .anvato import AnvatoIE
|
from .anvato import AnvatoIE
|
||||||
from .aol import AolIE
|
from .aol import AolIE
|
||||||
from .apa import APAIE
|
from .apa import APAIE
|
||||||
from .aparat import AparatIE
|
from .aparat import (
|
||||||
|
AparatIE,
|
||||||
|
AparatPlaylistIE,
|
||||||
|
)
|
||||||
from .appleconnect import AppleConnectIE
|
from .appleconnect import AppleConnectIE
|
||||||
from .applepodcasts import ApplePodcastsIE
|
from .applepodcasts import ApplePodcastsIE
|
||||||
from .appletrailers import (
|
from .appletrailers import (
|
||||||
|
|
|
@ -5,7 +5,9 @@ from ..utils import (
|
||||||
merge_dicts,
|
merge_dicts,
|
||||||
mimetype2ext,
|
mimetype2ext,
|
||||||
url_or_none,
|
url_or_none,
|
||||||
|
urljoin,
|
||||||
)
|
)
|
||||||
|
from ..utils.traversal import traverse_obj
|
||||||
|
|
||||||
|
|
||||||
class AparatIE(InfoExtractor):
|
class AparatIE(InfoExtractor):
|
||||||
|
@ -86,3 +88,69 @@ class AparatIE(InfoExtractor):
|
||||||
'duration': int_or_none(options.get('duration')),
|
'duration': int_or_none(options.get('duration')),
|
||||||
'formats': formats,
|
'formats': formats,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
class AparatPlaylistIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'https?://(?:www\.)?aparat\.com/playlist/(?P<id>\d+)'
|
||||||
|
|
||||||
|
_TESTS = [{
|
||||||
|
'url': 'https://www.aparat.com/playlist/1001307',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '1001307',
|
||||||
|
'title': 'مبانی یادگیری عمیق',
|
||||||
|
'description': '',
|
||||||
|
'thumbnails': 'count:2',
|
||||||
|
'channel': 'mrmohammadi_iust',
|
||||||
|
'channel_id': '6463423',
|
||||||
|
'channel_url': 'https://www.aparat.com/mrmohammadi_iust',
|
||||||
|
'channel_follower_count': int,
|
||||||
|
},
|
||||||
|
'playlist_mincount': 1,
|
||||||
|
'params': {
|
||||||
|
'skip_download': True,
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
'url': 'https://www.aparat.com/playlist/1234567',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '1234567',
|
||||||
|
'title': 'ساخت اکانت',
|
||||||
|
'description': '',
|
||||||
|
'thumbnails': 'count:0',
|
||||||
|
'channel': 'reza.shadow',
|
||||||
|
'channel_id': '8159952',
|
||||||
|
'channel_url': 'https://www.aparat.com/reza.shadow',
|
||||||
|
'channel_follower_count': int,
|
||||||
|
},
|
||||||
|
'playlist_count': 0,
|
||||||
|
'params': {
|
||||||
|
'skip_download': True,
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
'url': 'https://www.aparat.com/playlist/1256882',
|
||||||
|
'only_matching': True,
|
||||||
|
}]
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
playlist_id = self._match_id(url)
|
||||||
|
info = self._download_json(
|
||||||
|
f'https://www.aparat.com/api/fa/v1/video/playlist/one/playlist_id/{playlist_id}', playlist_id)
|
||||||
|
|
||||||
|
info_dict = traverse_obj(info, ('data', 'attributes', {
|
||||||
|
'playlist_title': ('title'),
|
||||||
|
'description': ('description'),
|
||||||
|
}), default={})
|
||||||
|
info_dict.update(thumbnails=traverse_obj([
|
||||||
|
traverse_obj(info, ('data', 'attributes', {'url': ('big_poster', {url_or_none})})),
|
||||||
|
traverse_obj(info, ('data', 'attributes', {'url': ('small_poster', {url_or_none})})),
|
||||||
|
], (...), default=[]))
|
||||||
|
info_dict.update(**traverse_obj(info, ('included', lambda _, v: v['type'] == 'channel', 'attributes', {
|
||||||
|
'channel': ('username'),
|
||||||
|
'channel_id': ('id'),
|
||||||
|
'channel_url': ('link', filter, {urljoin(base=url)}), # starts with a slash
|
||||||
|
'channel_follower_count': ('follower_cnt', {int_or_none}),
|
||||||
|
}), get_all=False))
|
||||||
|
|
||||||
|
return self.playlist_result(traverse_obj(info, (
|
||||||
|
'included', lambda _, v: v['type'] == 'Video', 'attributes', 'uid',
|
||||||
|
{lambda uid: self.url_result(f'https://www.aparat.com/v/{uid}?playlist={playlist_id}')},
|
||||||
|
), default=[]), playlist_id, **info_dict)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user