Merge 336f860303
into 4d05f84325
This commit is contained in:
commit
e076a7c880
@ -1326,6 +1326,7 @@ from .trovo import (
|
|||||||
TrovoVodIE,
|
TrovoVodIE,
|
||||||
)
|
)
|
||||||
from .trunews import TruNewsIE
|
from .trunews import TruNewsIE
|
||||||
|
from .truth import TruthIE
|
||||||
from .trutv import TruTVIE
|
from .trutv import TruTVIE
|
||||||
from .tube8 import Tube8IE
|
from .tube8 import Tube8IE
|
||||||
from .tubitv import TubiTvIE
|
from .tubitv import TubiTvIE
|
||||||
|
70
youtube_dl/extractor/truth.py
Normal file
70
youtube_dl/extractor/truth.py
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from .common import InfoExtractor
|
||||||
|
from ..utils import (
|
||||||
|
clean_html,
|
||||||
|
int_or_none,
|
||||||
|
strip_or_none,
|
||||||
|
unified_timestamp,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class TruthIE(InfoExtractor):
|
||||||
|
_VALID_URL = r'https?://truthsocial\.com/@[^/]+/posts/(?P<id>\d+)'
|
||||||
|
_TESTS = [
|
||||||
|
{
|
||||||
|
'url': 'https://truthsocial.com/@realDonaldTrump/posts/108779000807761862',
|
||||||
|
'md5': '4a5fb1470c192e493d9efd6f19e514d3',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '108779000807761862',
|
||||||
|
'ext': 'qt',
|
||||||
|
'title': 'Truth video #108779000807761862',
|
||||||
|
'description': None,
|
||||||
|
'timestamp': 1659835827,
|
||||||
|
'upload_date': '20220807',
|
||||||
|
'uploader': 'Donald J. Trump',
|
||||||
|
'uploader_id': 'realDonaldTrump',
|
||||||
|
'uploader_url': 'https://truthsocial.com/@realDonaldTrump',
|
||||||
|
'repost_count': int,
|
||||||
|
'comment_count': int,
|
||||||
|
'like_count': int,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'url': 'https://truthsocial.com/@ProjectVeritasAction/posts/108618228543962049',
|
||||||
|
'md5': 'fd47ba68933f9dce27accc52275be9c3',
|
||||||
|
'info_dict': {
|
||||||
|
'id': '108618228543962049',
|
||||||
|
'ext': 'mp4',
|
||||||
|
'title': 'md5:debde7186cf83f60ff7b44dbb9444e35',
|
||||||
|
'description': 'md5:e070ba6bcf6165957e26a7a94ef6d975',
|
||||||
|
'timestamp': 1657382637,
|
||||||
|
'upload_date': '20220709',
|
||||||
|
'uploader': 'Project Veritas Action',
|
||||||
|
'uploader_id': 'ProjectVeritasAction',
|
||||||
|
'uploader_url': 'https://truthsocial.com/@ProjectVeritasAction',
|
||||||
|
'repost_count': int,
|
||||||
|
'comment_count': int,
|
||||||
|
'like_count': int,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
def _real_extract(self, url):
|
||||||
|
video_id = self._match_id(url)
|
||||||
|
status = self._download_json('https://truthsocial.com/api/v1/statuses/' + video_id, video_id)
|
||||||
|
uploader_id = strip_or_none(status['account']['username'])
|
||||||
|
return {
|
||||||
|
'id': video_id,
|
||||||
|
'url': status['media_attachments'][0]['url'],
|
||||||
|
'title': 'Truth video #%s' % video_id,
|
||||||
|
'description': strip_or_none(clean_html(status.get('content'))) or None,
|
||||||
|
'timestamp': unified_timestamp(status.get('created_at')),
|
||||||
|
'uploader': strip_or_none(status['account']['display_name']),
|
||||||
|
'uploader_id': uploader_id,
|
||||||
|
'uploader_url': 'https://truthsocial.com/@%s' % uploader_id,
|
||||||
|
'repost_count': int_or_none(status.get('reblogs_count')),
|
||||||
|
'like_count': int_or_none(status.get('favourites_count')),
|
||||||
|
'comment_count': int_or_none(status.get('replies_count')),
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user