]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/yappy.py
1 from .common
import InfoExtractor
11 class YappyIE(InfoExtractor
):
12 _VALID_URL
= r
'https?://yappy\.media/video/(?P<id>\w+)'
14 'url': 'https://yappy.media/video/47fea6d8586f48d1a0cf96a7342aabd2',
16 'id': '47fea6d8586f48d1a0cf96a7342aabd2',
18 'title': 'Куда нажимать? Как снимать? Смотри видос и погнали!🤘🏻',
19 'timestamp': 1661893200,
20 'description': 'Куда нажимать? Как снимать? Смотри видос и погнали!🤘🏻',
21 'thumbnail': 'https://cdn-st.ritm.media/static/pic/thumbnails/0c7c4d73388f47848acaf540d2e2bb8c-thumbnail.jpg',
22 'upload_date': '20220830',
25 'uploader_id': '59a0c8c485e5410b9c43474bf4c6a373',
26 'categories': ['Образование и наука', 'Лайфхак', 'Технологии', 'Арт/искусство'],
31 'url': 'https://yappy.media/video/3862451954ad4bd58ae2ccefddb0bd33',
33 'id': '3862451954ad4bd58ae2ccefddb0bd33',
35 'title': 'Опиши свой характер 3 словами🙃\n#психология #дружба #отношения',
36 'timestamp': 1674726985,
38 'description': 'Опиши свой характер 3 словами🙃\n#психология #дружба #отношения',
39 'uploader_id': '6793ee3581974a3586fc01e157de6c99',
42 'uploader': 'LENA SHTURMAN',
43 'upload_date': '20230126',
44 'thumbnail': 'https://cdn-st.ritm.media/static/pic/user_thumbnails/6e76bb4bbad640b6/9ec84c115b2b1967/1674716171.jpg',
48 def _real_extract(self
, url
):
49 video_id
= self
._match
_id
(url
)
50 webpage
= self
._download
_webpage
(url
, video_id
)
51 json_ld
= self
._search
_json
_ld
(webpage
, video_id
)
52 nextjs_data
= self
._search
_nextjs
_data
(webpage
, video_id
)
56 nextjs_data
, ('props', 'pageProps', ('data', 'OpenGraphParameters')), get_all
=False)
57 or self
._download
_json
(f
'https://yappy.media/api/video/{video_id}', video_id
))
59 media_url
= traverse_obj(media_data
, ('link', {url_or_none}
)) or ''
60 has_watermark
= media_url
.endswith('-wm.mp4')
65 'format_note': 'Watermarked' if has_watermark
else None,
66 'preference': -10 if has_watermark
else None
67 }] if media_url
else []
71 'url': media_url
.replace('-wm.mp4', '.mp4'),
75 audio_link
= traverse_obj(media_data
, ('audio', 'link'))
86 'title': (json_ld
.get('description') or self
._html
_search
_meta
(['og:title'], webpage
)
87 or self
._html
_extract
_title
(webpage
)),
89 'thumbnail': (media_data
.get('thumbnail')
90 or self
._html
_search
_meta
(['og:image', 'og:image:secure_url'], webpage
)),
91 'description': (media_data
.get('description') or json_ld
.get('description')
92 or self
._html
_search
_meta
(['description', 'og:description'], webpage
)),
93 'timestamp': unified_timestamp(media_data
.get('publishedAt') or json_ld
.get('timestamp')),
94 'view_count': int_or_none(media_data
.get('viewsCount') or json_ld
.get('view_count')),
95 'like_count': int_or_none(media_data
.get('likesCount')),
96 'uploader': traverse_obj(media_data
, ('creator', 'firstName')),
97 'uploader_id': traverse_obj(media_data
, ('creator', ('uuid', 'nickname')), get_all
=False),
98 'categories': traverse_obj(media_data
, ('categories', ..., 'name')) or None,
99 'repost_count': int_or_none(media_data
.get('sharingCount'))
103 class YappyProfileIE(InfoExtractor
):
104 _VALID_URL
= r
'https?://yappy\.media/profile/(?P<id>\w+)'
106 'url': 'https://yappy.media/profile/59a0c8c485e5410b9c43474bf4c6a373',
108 'id': '59a0c8c485e5410b9c43474bf4c6a373',
110 'playlist_mincount': 527,
113 def _real_extract(self
, url
):
114 profile_id
= self
._match
_id
(url
)
116 def fetch_page(page_num
):
118 videos
= self
._download
_json
(
119 f
'https://yappy.media/api/video/list/{profile_id}?page={page_num}',
120 profile_id
, f
'Downloading profile page {page_num} JSON')
122 for video
in traverse_obj(videos
, ('results', lambda _
, v
: v
['uuid'])):
123 yield self
.url_result(
124 f
'https://yappy.media/video/{video["uuid"]}', YappyIE
,
125 video
['uuid'], video
.get('description'))
127 return self
.playlist_result(OnDemandPagedList(fetch_page
, 15), profile_id
)