1 from .common
import InfoExtractor
12 class TruthIE(InfoExtractor
):
13 _VALID_URL
= r
'https?://truthsocial\.com/@[^/]+/posts/(?P<id>\d+)'
16 'url': 'https://truthsocial.com/@realDonaldTrump/posts/108779000807761862',
17 'md5': '4a5fb1470c192e493d9efd6f19e514d3',
19 'id': '108779000807761862',
21 'title': 'Truth video #108779000807761862',
22 'timestamp': 1659835827,
23 'upload_date': '20220807',
24 'uploader': 'Donald J. Trump',
25 'uploader_id': 'realDonaldTrump',
26 'uploader_url': 'https://truthsocial.com/@realDonaldTrump',
33 'url': 'https://truthsocial.com/@ProjectVeritasAction/posts/108618228543962049',
34 'md5': 'fd47ba68933f9dce27accc52275be9c3',
36 'id': '108618228543962049',
38 'title': 'md5:debde7186cf83f60ff7b44dbb9444e35',
39 'description': 'md5:de2fc49045bf92bb8dc97e56503b150f',
40 'timestamp': 1657382637,
41 'upload_date': '20220709',
42 'uploader': 'Project Veritas Action',
43 'uploader_id': 'ProjectVeritasAction',
44 'uploader_url': 'https://truthsocial.com/@ProjectVeritasAction',
52 def _real_extract(self
, url
):
53 video_id
= self
._match
_id
(url
)
54 status
= self
._download
_json
(f
'https://truthsocial.com/api/v1/statuses/{video_id}', video_id
)
55 uploader_id
= strip_or_none(traverse_obj(status
, ('account', 'username')))
58 'url': status
['media_attachments'][0]['url'],
60 'description': strip_or_none(clean_html(status
.get('content'))) or None,
61 'timestamp': unified_timestamp(status
.get('created_at')),
62 'uploader': strip_or_none(traverse_obj(status
, ('account', 'display_name'))),
63 'uploader_id': uploader_id
,
64 'uploader_url': format_field(uploader_id
, None, 'https://truthsocial.com/@%s'),
65 'repost_count': int_or_none(status
.get('reblogs_count')),
66 'like_count': int_or_none(status
.get('favourites_count')),
67 'comment_count': int_or_none(status
.get('replies_count')),