generic_extractor.dropin
========================

.. py:module:: generic_extractor.dropin




Module Contents
---------------

.. py:class:: 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




   .. py:attribute:: extractor
      :type:  Type[auto_archiver.core.extractor.Extractor]
      :value: None



   .. py:method:: extract_post(url: str, ie_instance: yt_dlp.extractor.common.InfoExtractor)
      :abstractmethod:


      This method should return the post data from the url.



   .. py: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
      :abstractmethod:


      This method should create a Metadata object from the post data.



   .. py:method:: skip_ytdlp_download(url: str, ie_instance: yt_dlp.extractor.common.InfoExtractor)

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



   .. py:method:: keys_to_clean(video_data: dict, info_extractor: yt_dlp.extractor.common.InfoExtractor)

      This method should return a list of strings (keys) to clean from the video_data dict.

      E.g. ["uploader", "uploader_id", "tiktok_specific_field"]



   .. py:method:: download_additional_media(video_data: dict, info_extractor: yt_dlp.extractor.common.InfoExtractor, metadata: auto_archiver.core.metadata.Metadata)

      This method should download any additional media from the post.



   .. py:method:: suitable(url, info_extractor: yt_dlp.extractor.common.InfoExtractor)

      A method to allow dropins to override their InfoExtractor's 'suitable' method.
      Dropins should override this method and return True if the url is suitable for the extractor
      (based on being able to parse other URLs). See the `suitable_extractors` method in the
      `GenericExtractor` class for how this is implemented.

      The default behaviour of this method is to return the result of the InfoExtractor's 'suitable' method.

      ### Example: An example of where this is useful is for the FacebookIE extractor in yt-dlp. By default,
      it's 'suitable' method only returns True for video URLs. However, we can override this method in the
      Facebook dropin to return True for all Facebook URLs (photo/post types). This way, the Facebook dropin
      can be used for all Facebook URLs.



