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