Using as a Library¶
The extractor can also be used as a library instead of on the command line.
Typically, you would:
- instantiate a
WPDownloaderinstance and call itsdownloadmethod. - instantiate a
WPExtractorinstance and call itsextractmethod. The dataframes can then be accessed as class attributes or exported with theexportmethod.
Examples of usage are available in the CLI scripts in the wpextract.cli module.
Downloader¶
Use the wpextract.WPDownloader class.
Compared to the CLI, you can:
- implement highly custom request behaviour by subclassing
RequestSessionand passing to thesessionargument.
Extractor¶
Use the wpextract.WPExtractor class.
Compared to the CLI, you can:
- set customised translation pickers by passing subclasses of
LanguagePickerto thetranslation_pickersargument.