patreon.py 23 KB

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