logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

parler.py (3766B)


  1. from .common import InfoExtractor
  2. from .youtube import YoutubeIE
  3. from ..utils import (
  4. clean_html,
  5. int_or_none,
  6. strip_or_none,
  7. traverse_obj,
  8. unified_timestamp,
  9. urljoin,
  10. )
  11. class ParlerIE(InfoExtractor):
  12. IE_DESC = 'Posts on parler.com'
  13. _VALID_URL = r'https?://parler\.com/feed/(?P<id>[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12})'
  14. _TESTS = [
  15. {
  16. 'url': 'https://parler.com/feed/df79fdba-07cc-48fe-b085-3293897520d7',
  17. 'md5': '16e0f447bf186bb3cf64de5bbbf4d22d',
  18. 'info_dict': {
  19. 'id': 'df79fdba-07cc-48fe-b085-3293897520d7',
  20. 'ext': 'mp4',
  21. 'thumbnail': 'https://bl-images.parler.com/videos/6ce7cdf3-a27a-4d72-bf9c-d3e17ce39a66/thumbnail.jpeg',
  22. 'title': 'Parler video #df79fdba-07cc-48fe-b085-3293897520d7',
  23. 'description': 'md5:6f220bde2df4a97cbb89ac11f1fd8197',
  24. 'timestamp': 1659785481,
  25. 'upload_date': '20220806',
  26. 'uploader': 'Tulsi Gabbard',
  27. 'uploader_id': 'TulsiGabbard',
  28. 'uploader_url': 'https://parler.com/TulsiGabbard',
  29. 'view_count': int,
  30. 'comment_count': int,
  31. 'repost_count': int,
  32. },
  33. },
  34. {
  35. 'url': 'https://parler.com/feed/f23b85c1-6558-470f-b9ff-02c145f28da5',
  36. 'md5': 'eaba1ff4a10fe281f5ce74e930ab2cb4',
  37. 'info_dict': {
  38. 'id': 'r5vkSaz8PxQ',
  39. 'ext': 'mp4',
  40. 'live_status': 'not_live',
  41. 'comment_count': int,
  42. 'duration': 1267,
  43. 'like_count': int,
  44. 'channel_follower_count': int,
  45. 'channel_id': 'UCox6YeMSY1PQInbCtTaZj_w',
  46. 'upload_date': '20220716',
  47. 'thumbnail': 'https://i.ytimg.com/vi/r5vkSaz8PxQ/maxresdefault.jpg',
  48. 'tags': 'count:17',
  49. 'availability': 'public',
  50. 'categories': ['Entertainment'],
  51. 'playable_in_embed': True,
  52. 'channel': 'Who Knows What! With Mahesh & Friends',
  53. 'title': 'Tom MacDonald Names Reaction',
  54. 'uploader': 'Who Knows What! With Mahesh & Friends',
  55. 'uploader_id': '@maheshchookolingo',
  56. 'age_limit': 0,
  57. 'description': 'md5:33c21f0d35ae6dc2edf3007d6696baea',
  58. 'channel_url': 'https://www.youtube.com/channel/UCox6YeMSY1PQInbCtTaZj_w',
  59. 'view_count': int,
  60. 'uploader_url': 'http://www.youtube.com/@maheshchookolingo',
  61. },
  62. },
  63. ]
  64. def _real_extract(self, url):
  65. video_id = self._match_id(url)
  66. data = self._download_json(f'https://api.parler.com/v0/public/parleys/{video_id}',
  67. video_id)['data']
  68. if data.get('link'):
  69. return self.url_result(data['link'], YoutubeIE)
  70. return {
  71. 'id': video_id,
  72. 'title': strip_or_none(data.get('title')) or '',
  73. **traverse_obj(data, {
  74. 'url': ('video', 'videoSrc'),
  75. 'thumbnail': ('video', 'thumbnailUrl'),
  76. 'description': ('body', {clean_html}),
  77. 'timestamp': ('date_created', {unified_timestamp}),
  78. 'uploader': ('user', 'name', {strip_or_none}),
  79. 'uploader_id': ('user', 'username', {str}),
  80. 'uploader_url': ('user', 'username', {urljoin('https://parler.com/')}),
  81. 'view_count': ('views', {int_or_none}),
  82. 'comment_count': ('total_comments', {int_or_none}),
  83. 'repost_count': ('echos', {int_or_none}),
  84. }),
  85. }