metawarc (pronounced me-ta-warc) is a command line WARC files processing tools.
Its goal is to make CLI interaction with files inside WARC archives so easy as possible.
It provides a simple metawarc command that allows to extract metadata from images, documents and other files inside
WARC archives.
Contents
- Built-in WARC support
- Metadata extraction for a lot of file formats
- Low memory footprint
- Documentation
- Test coverage
- MS Office OLE: .doc, .xls, .ppt
- MS Office XML: .docx, .xlsx, .pptx
- Adobe PDF: .pdf
- Images: .png, .jpg, .tiff, .jpeg, .jp2
A universal installation method (that works on Windows, Mac OS X, Linux, …, and always provides the latest version) is to use pip:
# Make sure we have an up-to-date version of pip and setuptools:
$ pip install --upgrade pip setuptools
$ pip install --upgrade metawarc(If pip installation fails for some reason, you can try
easy_install metawarc as a fallback.)
Python version 3.6 or greater is required.
Synopsis:
$ metawarc [command] [flags] inputfileSee also metawarc --help and metawarc [command] --help for help for each command.
Index all WARC files in all subfolders
$ metawarc index '*/*.warc.gz'View file extensions statistics
$ metawarc stats -m extsList all PDF files
$ metawarc list-files -e pdfDumps all records with size greater than 10M and file extension 'pdf' to 'bigpdf' directory
$ metawarc dump -q "content_length > 10000000 and ext = 'pdf'" -o bigpdfGenerates 'warcindex.db' DuckDB database with WARC files meta and for each WARC file generated two Parquet files in 'data' directory, they inherit WARC file name and have suffix '_records' and "_headers". All of them registered in 'warcindex.db' with tables as "files" and "tables".
Analyzes 'armstat.am.warc.gz' and writes 'warcindex.db' with records and headers metadata.
$ metawarc index armstat.am.warc.gzAnalyzes all WARC files in all subfolders and writes 'warcindex.db' with records and headers metadata.
$ metawarc index '*/*.warc.gz'Analyzes WARC files records and extracts relevant metadata / content for future reuse. Supported metadata types: ooxmldocs, oledocs, pdfs, images, links Results saved to Parquet file in 'data' directory with suffix of the related metdata. For example '_images' for images.
Collects PDF files metadata from all WARC files
$ metawarc index-content -t pdfsCollects all links for selected WARC file (should be listed in 'warcindex.db' after index command run)
$ metawarc index-content -i armstat.am.warc.gz -t linksReturns total length and count of records by each mime or file extension.
Processes data in 'metawarc.db' and prints total length and count for each mime
$ metawarc stats -m mimesProcesses data in 'metawarc.db' and prints total length and count for each file extension
$ metawarc stats -m extsDumps metadata from tables. Supported metadata types: pdfs, ooxmldocs, oledocs, images, links
Exports PDF files metadata and writes as 'pdfs_metadata.jsonl'
$ metawarc dump-metadata -t pdfs -o pdfs_metadata.jsonlPrints list of records with id, offset, length and url using 'metawarc.db'. Accepts list of mime types or list of file extensions or query as WHERE clause
Prints all records with mime type (content type) 'application/zip'
$ metawarc list-files -m 'application/zip'Prints all records with file extensions 'xls' and 'xlsx'
$ metawarc list-files -e xls,xlsxPrints all records with size greater than 10M and file extension 'pdf'
$ metawarc list-files -q "content_length > 10000000 and ext = 'pdf'"Dumps records payloads as files using 'metawarc.db' as WARC index. Accepts list of mime types or list of file extensions or query as WHERE clause. Adds CSV file 'records.csv' to the output directory with basic data about each dumped record.
Dumps all records with mime type (content type) 'application/zip' to 'allzip' directory
$ metawarc dump -m 'application/zip' -o allzipDumps all records with file extensions 'xls' and 'xlsx' to 'sheets' directory
$ metawarc dump -e xls,xlsx -o sheetsDumps all records with size greater than 10M and file extension 'pdf' to 'bigpdf' directory
$ metawarc dump -q "content_length > 10000000 and ext = 'pdf'" -o bigpdf