]> jfr.im git - yt-dlp.git/blame - yt_dlp/extractor/patreon.py
[ie/youtube] Suppress "Unavailable videos are hidden" warning (#10159)
[yt-dlp.git] / yt_dlp / extractor / patreon.py
CommitLineData
1dd6d9ca 1import itertools
c9ce57d9 2import urllib.parse
1dd6d9ca 3
a00d73c8 4from .common import InfoExtractor
d6c2c2bc 5from .sproutvideo import VidsIoIE
65af1839 6from .vimeo import VimeoIE
3d2623a8 7from ..networking.exceptions import HTTPError
c9d891f1 8from ..utils import (
11de6fec 9 KNOWN_EXTENSIONS,
10 ExtractorError,
c9d891f1
RA
11 clean_html,
12 determine_ext,
13 int_or_none,
b77c3949 14 mimetype2ext,
c9d891f1 15 parse_iso8601,
d6c2c2bc 16 smuggle_url,
b77c3949 17 str_or_none,
4f08e586 18 traverse_obj,
1dd6d9ca 19 url_or_none,
11de6fec 20 urljoin,
c9d891f1 21)
a00d73c8
EJ
22
23
4f08e586 24class PatreonBaseIE(InfoExtractor):
25 USER_AGENT = 'Patreon/7.6.28 (Android; Android 11; Scale/2.10)'
26
27 def _call_api(self, ep, item_id, query=None, headers=None, fatal=True, note=None):
28 if headers is None:
29 headers = {}
30 if 'User-Agent' not in headers:
31 headers['User-Agent'] = self.USER_AGENT
32 if query:
33 query.update({'json-api-version': 1.0})
34
35 try:
36 return self._download_json(
37 f'https://www.patreon.com/api/{ep}',
add96eb9 38 item_id, note=note if note else 'Downloading API JSON',
4f08e586 39 query=query, fatal=fatal, headers=headers)
40 except ExtractorError as e:
3d2623a8 41 if not isinstance(e.cause, HTTPError) or mimetype2ext(e.cause.response.headers.get('Content-Type')) != 'json':
4f08e586 42 raise
3d2623a8 43 err_json = self._parse_json(self._webpage_read_content(e.cause.response, None, item_id), item_id, fatal=False)
4f08e586 44 err_message = traverse_obj(err_json, ('errors', ..., 'detail'), get_all=False)
45 if err_message:
46 raise ExtractorError(f'Patreon said: {err_message}', expected=True)
47 raise
48
49
50class PatreonIE(PatreonBaseIE):
c9d891f1
RA
51 _VALID_URL = r'https?://(?:www\.)?patreon\.com/(?:creation\?hid=|posts/(?:[\w-]+-)?)(?P<id>\d+)'
52 _TESTS = [{
53 'url': 'http://www.patreon.com/creation?hid=743933',
54 'md5': 'e25505eec1053a6e6813b8ed369875cc',
55 'info_dict': {
56 'id': '743933',
57 'ext': 'mp3',
58 'title': 'Episode 166: David Smalley of Dogma Debate',
4f08e586 59 'description': 'md5:34d207dd29aa90e24f1b3f58841b81c7',
c9d891f1
RA
60 'uploader': 'Cognitive Dissonance Podcast',
61 'thumbnail': 're:^https?://.*$',
62 'timestamp': 1406473987,
63 'upload_date': '20140727',
b77c3949 64 'uploader_id': '87145',
4f08e586 65 'like_count': int,
66 'comment_count': int,
67 'uploader_url': 'https://www.patreon.com/dissonancepod',
68 'channel_id': '80642',
69 'channel_url': 'https://www.patreon.com/dissonancepod',
70 'channel_follower_count': int,
c9d891f1
RA
71 },
72 }, {
73 'url': 'http://www.patreon.com/creation?hid=754133',
74 'md5': '3eb09345bf44bf60451b8b0b81759d0a',
75 'info_dict': {
76 'id': '754133',
77 'ext': 'mp3',
78 'title': 'CD 167 Extra',
79 'uploader': 'Cognitive Dissonance Podcast',
80 'thumbnail': 're:^https?://.*$',
4f08e586 81 'like_count': int,
82 'comment_count': int,
83 'uploader_url': 'https://www.patreon.com/dissonancepod',
a00d73c8 84 },
c9d891f1
RA
85 'skip': 'Patron-only content',
86 }, {
87 'url': 'https://www.patreon.com/creation?hid=1682498',
88 'info_dict': {
89 'id': 'SU4fj_aEMVw',
90 'ext': 'mp4',
91 'title': 'I\'m on Patreon!',
92 'uploader': 'TraciJHines',
93 'thumbnail': 're:^https?://.*$',
94 'upload_date': '20150211',
4f08e586 95 'description': 'md5:8af6425f50bd46fbf29f3db0fc3a8364',
36b240f9 96 'uploader_id': '@TraciHinesMusic',
4f08e586 97 'categories': ['Entertainment'],
98 'duration': 282,
99 'view_count': int,
100 'tags': 'count:39',
101 'age_limit': 0,
102 'channel': 'TraciJHines',
103 'channel_url': 'https://www.youtube.com/channel/UCGLim4T2loE5rwCMdpCIPVg',
104 'live_status': 'not_live',
105 'like_count': int,
106 'channel_id': 'UCGLim4T2loE5rwCMdpCIPVg',
107 'availability': 'public',
108 'channel_follower_count': int,
109 'playable_in_embed': True,
36b240f9 110 'uploader_url': 'https://www.youtube.com/@TraciHinesMusic',
4f08e586 111 'comment_count': int,
36b240f9
JV
112 'channel_is_verified': True,
113 'chapters': 'count:4',
6994e706 114 },
c9d891f1
RA
115 'params': {
116 'noplaylist': True,
117 'skip_download': True,
add96eb9 118 },
c9d891f1
RA
119 }, {
120 'url': 'https://www.patreon.com/posts/episode-166-of-743933',
121 'only_matching': True,
122 }, {
123 'url': 'https://www.patreon.com/posts/743933',
124 'only_matching': True,
65af1839 125 }, {
126 'url': 'https://www.patreon.com/posts/kitchen-as-seen-51706779',
127 'md5': '96656690071f6d64895866008484251b',
128 'info_dict': {
129 'id': '555089736',
130 'ext': 'mp4',
131 'title': 'KITCHEN AS SEEN ON DEEZ NUTS EXTENDED!',
132 'uploader': 'Cold Ones',
133 'thumbnail': 're:^https?://.*$',
134 'upload_date': '20210526',
135 'description': 'md5:557a409bd79d3898689419094934ba79',
136 'uploader_id': '14936315',
137 },
add96eb9 138 'skip': 'Patron-only content',
4f08e586 139 }, {
140 # m3u8 video (https://github.com/yt-dlp/yt-dlp/issues/2277)
141 'url': 'https://www.patreon.com/posts/video-sketchbook-32452882',
142 'info_dict': {
143 'id': '32452882',
144 'ext': 'mp4',
145 'comment_count': int,
146 'uploader_id': '4301314',
147 'like_count': int,
148 'timestamp': 1576696962,
149 'upload_date': '20191218',
150 'thumbnail': r're:^https?://.*$',
151 'uploader_url': 'https://www.patreon.com/loish',
152 'description': 'md5:e2693e97ee299c8ece47ffdb67e7d9d2',
153 'title': 'VIDEO // sketchbook flipthrough',
154 'uploader': 'Loish ',
155 'tags': ['sketchbook', 'video'],
156 'channel_id': '1641751',
157 'channel_url': 'https://www.patreon.com/loish',
158 'channel_follower_count': int,
add96eb9 159 },
cea4b857 160 }, {
161 # bad videos under media (if media is included). Real one is under post_file
162 'url': 'https://www.patreon.com/posts/premium-access-70282931',
163 'info_dict': {
164 'id': '70282931',
165 'ext': 'mp4',
166 'title': '[Premium Access + Uncut] The Office - 2x6 The Fight - Group Reaction',
167 'channel_url': 'https://www.patreon.com/thenormies',
168 'channel_id': '573397',
169 'uploader_id': '2929435',
170 'uploader': 'The Normies',
171 'description': 'md5:79c9fd8778e2cef84049a94c058a5e23',
172 'comment_count': int,
173 'upload_date': '20220809',
174 'thumbnail': r're:^https?://.*$',
175 'channel_follower_count': int,
176 'like_count': int,
177 'timestamp': 1660052820,
178 'tags': ['The Office', 'early access', 'uncut'],
179 'uploader_url': 'https://www.patreon.com/thenormies',
180 },
181 'skip': 'Patron-only content',
36b240f9
JV
182 }, {
183 # dead vimeo and embed URLs, need to extract post_file
184 'url': 'https://www.patreon.com/posts/hunter-x-hunter-34007913',
185 'info_dict': {
186 'id': '34007913',
187 'ext': 'mp4',
188 'title': 'Hunter x Hunter | Kurapika DESTROYS Uvogin!!!',
189 'like_count': int,
190 'uploader': 'YaBoyRoshi',
191 'timestamp': 1581636833,
192 'channel_url': 'https://www.patreon.com/yaboyroshi',
193 'thumbnail': r're:^https?://.*$',
194 'tags': ['Hunter x Hunter'],
195 'uploader_id': '14264111',
196 'comment_count': int,
197 'channel_follower_count': int,
198 'description': 'Kurapika is a walking cheat code!',
199 'upload_date': '20200213',
200 'channel_id': '2147162',
201 'uploader_url': 'https://www.patreon.com/yaboyroshi',
202 },
c9ce57d9 203 }, {
204 # NSFW vimeo embed URL
205 'url': 'https://www.patreon.com/posts/4k-spiderman-4k-96414599',
206 'info_dict': {
207 'id': '902250943',
208 'ext': 'mp4',
209 'title': '❤️(4K) Spiderman Girl Yeonhwa’s Gift ❤️(4K) 스파이더맨걸 연화의 선물',
210 'description': '❤️(4K) Spiderman Girl Yeonhwa’s Gift \n❤️(4K) 스파이더맨걸 연화의 선물',
211 'uploader': 'Npickyeonhwa',
212 'uploader_id': '90574422',
213 'uploader_url': 'https://www.patreon.com/Yeonhwa726',
214 'channel_id': '10237902',
215 'channel_url': 'https://www.patreon.com/Yeonhwa726',
216 'duration': 70,
217 'timestamp': 1705150153,
218 'upload_date': '20240113',
219 'comment_count': int,
220 'like_count': int,
221 'thumbnail': r're:^https?://.+',
222 },
223 'params': {'skip_download': 'm3u8'},
036e0d92 224 }, {
225 # multiple attachments/embeds
226 'url': 'https://www.patreon.com/posts/holy-wars-solos-100601977',
227 'playlist_count': 3,
228 'info_dict': {
229 'id': '100601977',
230 'title': '"Holy Wars" (Megadeth) Solos Transcription & Lesson/Analysis',
231 'description': 'md5:d099ab976edfce6de2a65c2b169a88d3',
232 'uploader': 'Bradley Hall',
233 'uploader_id': '24401883',
234 'uploader_url': 'https://www.patreon.com/bradleyhallguitar',
235 'channel_id': '3193932',
236 'channel_url': 'https://www.patreon.com/bradleyhallguitar',
237 'channel_follower_count': int,
238 'timestamp': 1710777855,
239 'upload_date': '20240318',
240 'like_count': int,
241 'comment_count': int,
242 'thumbnail': r're:^https?://.+',
243 },
244 'skip': 'Patron-only content',
4f08e586 245 }]
036e0d92 246 _RETURN_TYPE = 'video'
a00d73c8
EJ
247
248 def _real_extract(self, url):
77070040 249 video_id = self._match_id(url)
4f08e586 250 post = self._call_api(
251 f'posts/{video_id}', video_id, query={
b77c3949 252 'fields[media]': 'download_url,mimetype,size_bytes',
4f08e586 253 'fields[post]': 'comment_count,content,embed,image,like_count,post_file,published_at,title,current_user_can_view',
b77c3949 254 'fields[user]': 'full_name,url',
4f08e586 255 'fields[post_tag]': 'value',
256 'fields[campaign]': 'url,name,patron_count',
b77c3949 257 'json-api-use-default-includes': 'false',
cea4b857 258 'include': 'audio,user,user_defined_tags,campaign,attachments_media',
b77c3949 259 })
c9d891f1 260 attributes = post['data']['attributes']
036e0d92 261 info = traverse_obj(attributes, {
262 'title': ('title', {str.strip}),
263 'description': ('content', {clean_html}),
264 'thumbnail': ('image', ('large_url', 'url'), {url_or_none}, any),
265 'timestamp': ('published_at', {parse_iso8601}),
266 'like_count': ('like_count', {int_or_none}),
267 'comment_count': ('comment_count', {int_or_none}),
268 })
c9d891f1 269
036e0d92 270 entries = []
271 idx = 0
272 for include in traverse_obj(post, ('included', lambda _, v: v['type'])):
273 include_type = include['type']
274 if include_type == 'media':
275 media_attributes = traverse_obj(include, ('attributes', {dict})) or {}
276 download_url = url_or_none(media_attributes.get('download_url'))
b77c3949 277 ext = mimetype2ext(media_attributes.get('mimetype'))
cea4b857 278
279 # if size_bytes is None, this media file is likely unavailable
280 # See: https://github.com/yt-dlp/yt-dlp/issues/4608
281 size_bytes = int_or_none(media_attributes.get('size_bytes'))
282 if download_url and ext in KNOWN_EXTENSIONS and size_bytes is not None:
036e0d92 283 idx += 1
284 entries.append({
285 'id': f'{video_id}-{idx}',
b77c3949 286 'ext': ext,
cea4b857 287 'filesize': size_bytes,
b77c3949 288 'url': download_url,
c9d891f1
RA
289 })
290
036e0d92 291 elif include_type == 'user':
292 info.update(traverse_obj(include, {
293 'uploader': ('attributes', 'full_name', {str}),
294 'uploader_id': ('id', {str_or_none}),
295 'uploader_url': ('attributes', 'url', {url_or_none}),
296 }))
65af1839 297
036e0d92 298 elif include_type == 'post_tag':
299 if post_tag := traverse_obj(include, ('attributes', 'value', {str})):
300 info.setdefault('tags', []).append(post_tag)
301
302 elif include_type == 'campaign':
303 info.update(traverse_obj(include, {
304 'channel': ('attributes', 'title', {str}),
305 'channel_id': ('id', {str_or_none}),
306 'channel_url': ('attributes', 'url', {url_or_none}),
307 'channel_follower_count': ('attributes', 'patron_count', {int_or_none}),
308 }))
19a35285 309
d6c2c2bc 310 # all-lowercase 'referer' so we can smuggle it to Generic, SproutVideo, Vimeo
311 headers = {'referer': 'https://patreon.com/'}
312
4f08e586 313 # handle Vimeo embeds
c9ce57d9 314 if traverse_obj(attributes, ('embed', 'provider')) == 'Vimeo':
315 v_url = urllib.parse.unquote(self._html_search_regex(
316 r'(https(?:%3A%2F%2F|://)player\.vimeo\.com.+app_id(?:=|%3D)+\d+)',
317 traverse_obj(attributes, ('embed', 'html', {str})), 'vimeo url', fatal=False) or '')
318 if url_or_none(v_url) and self._request_webpage(
d6c2c2bc 319 v_url, video_id, 'Checking Vimeo embed URL', headers=headers, fatal=False, errnote=False):
036e0d92 320 entries.append(self.url_result(
c9ce57d9 321 VimeoIE._smuggle_referrer(v_url, 'https://patreon.com/'),
036e0d92 322 VimeoIE, url_transparent=True))
4f08e586 323
c9ce57d9 324 embed_url = traverse_obj(attributes, ('embed', 'url', {url_or_none}))
d6c2c2bc 325 if embed_url and (urlh := self._request_webpage(
326 embed_url, video_id, 'Checking embed URL', headers=headers,
327 fatal=False, errnote=False, expected_status=403)):
328 # Password-protected vids.io embeds return 403 errors w/o --video-password or session cookie
329 if urlh.status != 403 or VidsIoIE.suitable(embed_url):
330 entries.append(self.url_result(smuggle_url(embed_url, headers)))
4f08e586 331
036e0d92 332 post_file = traverse_obj(attributes, ('post_file', {dict}))
4f08e586 333 if post_file:
334 name = post_file.get('name')
335 ext = determine_ext(name)
b77c3949 336 if ext in KNOWN_EXTENSIONS:
036e0d92 337 entries.append({
338 'id': video_id,
b77c3949
RA
339 'ext': ext,
340 'url': post_file['url'],
036e0d92 341 })
f0e8bc7c 342 elif name == 'video' or determine_ext(post_file.get('url')) == 'm3u8':
4f08e586 343 formats, subtitles = self._extract_m3u8_formats_and_subtitles(post_file['url'], video_id)
036e0d92 344 entries.append({
345 'id': video_id,
4f08e586 346 'formats': formats,
347 'subtitles': subtitles,
036e0d92 348 })
c9d891f1 349
036e0d92 350 can_view_post = traverse_obj(attributes, 'current_user_can_view')
351 comments = None
352 if can_view_post and info.get('comment_count'):
353 comments = self.extract_comments(video_id)
354
355 if not entries and can_view_post is False:
4f08e586 356 self.raise_no_formats('You do not have access to this post', video_id=video_id, expected=True)
036e0d92 357 elif not entries:
4f08e586 358 self.raise_no_formats('No supported media found in this post', video_id=video_id, expected=True)
036e0d92 359 elif len(entries) == 1:
360 info.update(entries[0])
361 else:
362 for entry in entries:
363 entry.update(info)
364 return self.playlist_result(entries, video_id, **info, __post_extractor=comments)
365
366 info['id'] = video_id
367 info['__post_extractor'] = comments
c9d891f1 368 return info
1dd6d9ca 369
4f08e586 370 def _get_comments(self, post_id):
371 cursor = None
372 count = 0
373 params = {
374 'page[count]': 50,
375 'include': 'parent.commenter.campaign,parent.post.user,parent.post.campaign.creator,parent.replies.parent,parent.replies.commenter.campaign,parent.replies.post.user,parent.replies.post.campaign.creator,commenter.campaign,post.user,post.campaign.creator,replies.parent,replies.commenter.campaign,replies.post.user,replies.post.campaign.creator,on_behalf_of_campaign',
376 'fields[comment]': 'body,created,is_by_creator',
377 'fields[user]': 'image_url,full_name,url',
378 'filter[flair]': 'image_tiny_url,name',
379 'sort': '-created',
380 'json-api-version': 1.0,
381 'json-api-use-default-includes': 'false',
382 }
383
384 for page in itertools.count(1):
385
386 params.update({'page[cursor]': cursor} if cursor else {})
387 response = self._call_api(
add96eb9 388 f'posts/{post_id}/comments', post_id, query=params, note=f'Downloading comments page {page}')
4f08e586 389
390 cursor = None
6839ae1f 391 for comment in traverse_obj(response, (('data', ('included', lambda _, v: v['type'] == 'comment')), ...)):
4f08e586 392 count += 1
393 comment_id = comment.get('id')
394 attributes = comment.get('attributes') or {}
395 if comment_id is None:
396 continue
397 author_id = traverse_obj(comment, ('relationships', 'commenter', 'data', 'id'))
398 author_info = traverse_obj(
399 response, ('included', lambda _, v: v['id'] == author_id and v['type'] == 'user', 'attributes'),
400 get_all=False, expected_type=dict, default={})
401
402 yield {
403 'id': comment_id,
404 'text': attributes.get('body'),
405 'timestamp': parse_iso8601(attributes.get('created')),
406 'parent': traverse_obj(comment, ('relationships', 'parent', 'data', 'id'), default='root'),
407 'author_is_uploader': attributes.get('is_by_creator'),
408 'author_id': author_id,
409 'author': author_info.get('full_name'),
410 'author_thumbnail': author_info.get('image_url'),
411 }
412
413 if count < traverse_obj(response, ('meta', 'count')):
414 cursor = traverse_obj(response, ('data', -1, 'id'))
415
416 if cursor is None:
417 break
1dd6d9ca 418
1dd6d9ca 419
4f08e586 420class PatreonCampaignIE(PatreonBaseIE):
1dd6d9ca 421
4f08e586 422 _VALID_URL = r'https?://(?:www\.)?patreon\.com/(?!rss)(?:(?:m/(?P<campaign_id>\d+))|(?P<vanity>[-\w]+))'
1dd6d9ca 423 _TESTS = [{
424 'url': 'https://www.patreon.com/dissonancepod/',
425 'info_dict': {
4f08e586 426 'title': 'Cognitive Dissonance Podcast',
427 'channel_url': 'https://www.patreon.com/dissonancepod',
428 'id': '80642',
429 'description': 'md5:eb2fa8b83da7ab887adeac34da6b7af7',
430 'channel_id': '80642',
431 'channel': 'Cognitive Dissonance Podcast',
432 'age_limit': 0,
433 'channel_follower_count': int,
434 'uploader_id': '87145',
435 'uploader_url': 'https://www.patreon.com/dissonancepod',
436 'uploader': 'Cognitive Dissonance Podcast',
437 'thumbnail': r're:^https?://.*$',
1dd6d9ca 438 },
439 'playlist_mincount': 68,
4f08e586 440 }, {
441 'url': 'https://www.patreon.com/m/4767637/posts',
442 'info_dict': {
443 'title': 'Not Just Bikes',
444 'channel_follower_count': int,
445 'id': '4767637',
446 'channel_id': '4767637',
447 'channel_url': 'https://www.patreon.com/notjustbikes',
448 'description': 'md5:595c6e7dca76ae615b1d38c298a287a1',
449 'age_limit': 0,
450 'channel': 'Not Just Bikes',
451 'uploader_url': 'https://www.patreon.com/notjustbikes',
452 'uploader': 'Not Just Bikes',
453 'uploader_id': '37306634',
454 'thumbnail': r're:^https?://.*$',
455 },
add96eb9 456 'playlist_mincount': 71,
1dd6d9ca 457 }, {
458 'url': 'https://www.patreon.com/dissonancepod/posts',
add96eb9 459 'only_matching': True,
4f08e586 460 }, {
461 'url': 'https://www.patreon.com/m/5932659',
add96eb9 462 'only_matching': True,
4f08e586 463 }]
1dd6d9ca 464
465 @classmethod
466 def suitable(cls, url):
add96eb9 467 return False if PatreonIE.suitable(url) else super().suitable(url)
1dd6d9ca 468
4f08e586 469 def _entries(self, campaign_id):
1dd6d9ca 470 cursor = None
471 params = {
4f08e586 472 'fields[post]': 'patreon_url,url',
1dd6d9ca 473 'filter[campaign_id]': campaign_id,
474 'filter[is_draft]': 'false',
475 'sort': '-published_at',
1dd6d9ca 476 'json-api-use-default-includes': 'false',
477 }
478
479 for page in itertools.count(1):
480
481 params.update({'page[cursor]': cursor} if cursor else {})
add96eb9 482 posts_json = self._call_api('posts', campaign_id, query=params, note=f'Downloading posts page {page}')
1dd6d9ca 483
4f08e586 484 cursor = traverse_obj(posts_json, ('meta', 'pagination', 'cursors', 'next'))
11de6fec 485 for post_url in traverse_obj(posts_json, ('data', ..., 'attributes', 'patreon_url')):
486 yield self.url_result(urljoin('https://www.patreon.com/', post_url), PatreonIE)
1dd6d9ca 487
488 if cursor is None:
489 break
490
491 def _real_extract(self, url):
492
4f08e586 493 campaign_id, vanity = self._match_valid_url(url).group('campaign_id', 'vanity')
494 if campaign_id is None:
495 webpage = self._download_webpage(url, vanity, headers={'User-Agent': self.USER_AGENT})
2e5a47da 496 campaign_id = self._search_nextjs_data(
497 webpage, vanity)['props']['pageProps']['bootstrapEnvelope']['pageBootstrap']['campaign']['data']['id']
4f08e586 498
499 params = {
500 'json-api-use-default-includes': 'false',
501 'fields[user]': 'full_name,url',
502 'fields[campaign]': 'name,summary,url,patron_count,creation_count,is_nsfw,avatar_photo_url',
add96eb9 503 'include': 'creator',
4f08e586 504 }
505
506 campaign_response = self._call_api(
507 f'campaigns/{campaign_id}', campaign_id,
508 note='Downloading campaign info', fatal=False,
509 query=params) or {}
510
511 campaign_info = campaign_response.get('data') or {}
512 channel_name = traverse_obj(campaign_info, ('attributes', 'name'))
513 user_info = traverse_obj(
514 campaign_response, ('included', lambda _, v: v['type'] == 'user'),
515 default={}, expected_type=dict, get_all=False)
516
517 return {
518 '_type': 'playlist',
519 'id': campaign_id,
520 'title': channel_name,
521 'entries': self._entries(campaign_id),
522 'description': clean_html(traverse_obj(campaign_info, ('attributes', 'summary'))),
523 'channel_url': traverse_obj(campaign_info, ('attributes', 'url')),
524 'channel_follower_count': int_or_none(traverse_obj(campaign_info, ('attributes', 'patron_count'))),
525 'channel_id': campaign_id,
526 'channel': channel_name,
527 'uploader_url': traverse_obj(user_info, ('attributes', 'url')),
528 'uploader_id': str_or_none(user_info.get('id')),
529 'uploader': traverse_obj(user_info, ('attributes', 'full_name')),
530 'playlist_count': traverse_obj(campaign_info, ('attributes', 'creation_count')),
531 'age_limit': 18 if traverse_obj(campaign_info, ('attributes', 'is_nsfw')) else 0,
532 'thumbnail': url_or_none(traverse_obj(campaign_info, ('attributes', 'avatar_photo_url'))),
533 }