generic_extractor.truth#

Module Contents#

class generic_extractor.truth.Truth#

Bases: generic_extractor.dropin.GenericDropin

Base class for dropins for the generic extractor.

In many instances, an extractor will exist in ytdlp, but it will only process videos. Dropins can be created and used to make use of the already-written private code of a specific extractor from ytdlp.

The dropin should be able to handle the following methods:

  • get_post_data: This method should be able to extract the post data from the url and return it as a dict.

  • create_metadata: This method should be able to create a Metadata object from a post dict.

Optional methods include:

  • skip_ytdlp_download: If you want to skip the ytdlp ‘download’ method all together, and do your own, then return True for this method.

    This is useful in cases where ytdlp might not work properly for all of your posts

  • keys_to_clean: for the generic ‘video_data’ created by ytdlp (for video URLs), any additional fields you would like to clean out of the data before storing in metadata

extract_post(url, ie_instance: yt_dlp.extractor.common.InfoExtractor) dict#

This method should return the post data from the url.

skip_ytdlp_download(url, ie_instance: Type[yt_dlp.extractor.common.InfoExtractor]) bool#

This method should return True if you want to skip the ytdlp download method.

create_metadata(post: dict, ie_instance: yt_dlp.extractor.common.InfoExtractor, archiver: auto_archiver.core.extractor.Extractor, url: str) auto_archiver.core.metadata.Metadata#

Creates metadata from a truth social post

Only used for posts that contain no media. ytdlp.TruthIE extractor can handle posts with media

Format is:

{‘id’: ‘109598702184774628’, ‘created_at’: ‘2022-12-29T19:51:18.161Z’, ‘in_reply_to_id’: None, ‘quote_id’: None, ‘in_reply_to_account_id’: None, ‘sensitive’: False, ‘spoiler_text’: ‘’, ‘visibility’: ‘public’, ‘language’: ‘en’, ‘uri’: ‘https://truthsocial.com/@bbcnewa/109598702184774628’, ‘url’: ‘https://truthsocial.com/@bbcnewa/109598702184774628’, ‘content’: ‘<p>Pele, regarded by many as football’s greatest ever player, has died in Brazil at the age of 82. <a href=”https://www.bbc.com/sport/football/42751517” rel=”nofollow noopener noreferrer” target=”_blank”><span class=”invisible”>https://www.</span><span class=”ellipsis”>bbc.com/sport/football/4275151</span><span class=”invisible”>7</span></a></p>’, ‘account’: {‘id’: ‘107905163010312793’, ‘username’: ‘bbcnewa’, ‘acct’: ‘bbcnewa’, ‘display_name’: ‘BBC News’, ‘locked’: False, ‘bot’: False, ‘discoverable’: True, ‘group’: False, ‘created_at’: ‘2022-03-05T17:42:01.159Z’, ‘note’: ‘<p>News, features and analysis by the BBC</p>’, ‘url’: ‘https://truthsocial.com/@bbcnewa’, ‘avatar’: ‘https://static-assets-1.truthsocial.com/tmtg:prime-ts-assets/accounts/avatars/107/905/163/010/312/793/original/e7c07550dc22c23a.jpeg’, ‘avatar_static’: ‘https://static-assets-1.truthsocial.com/tmtg:prime-ts-assets/accounts/avatars/107/905/163/010/312/793/original/e7c07550dc22c23a.jpeg’, ‘header’: ‘https://static-assets-1.truthsocial.com/tmtg:prime-ts-assets/accounts/headers/107/905/163/010/312/793/original/a00eeec2b57206c7.jpeg’, ‘header_static’: ‘https://static-assets-1.truthsocial.com/tmtg:prime-ts-assets/accounts/headers/107/905/163/010/312/793/original/a00eeec2b57206c7.jpeg’, ‘followers_count’: 1131, ‘following_count’: 3, ‘statuses_count’: 9, ‘last_status_at’: ‘2024-11-12’, ‘verified’: False, ‘location’: ‘’, ‘website’: ‘https://www.bbc.com/news’, ‘unauth_visibility’: True, ‘chats_onboarded’: True, ‘feeds_onboarded’: True, ‘accepting_messages’: False, ‘show_nonmember_group_statuses’: None, ‘emojis’: [], ‘fields’: [], ‘tv_onboarded’: True, ‘tv_account’: False}, ‘media_attachments’: [], ‘mentions’: [], ‘tags’: [], ‘card’: None, ‘group’: None, ‘quote’: None, ‘in_reply_to’: None, ‘reblog’: None, ‘sponsored’: False, ‘replies_count’: 1, ‘reblogs_count’: 0, ‘favourites_count’: 2, ‘favourited’: False, ‘reblogged’: False, ‘muted’: False, ‘pinned’: False, ‘bookmarked’: False, ‘poll’: None, ‘emojis’: []}