Skip to content

Experiences converting Common Crawl's ARC files from the crawls 2008 - 2012 to the WARC format

Notifications You must be signed in to change notification settings

commoncrawl/arc2warc-conversion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Conversion of Common Crawl ARC Files to WARC

In this project we want to share our experiences with converting Common Crawl's older ARC archives to WARC:

  • issues observed during the conversion
  • tools used for the conversion
  • tests to verify the resulting WARC files

Background

The first three crawls run by the Common Crawl Foundation (CCF) used the ARC file format as primary archive format for web captures. The ARC files have been written with varying crawler software. In total, there are 130 TiB ARC data:

  • May 2008 - Jan 2009 (crawl-001), Nutch
    • 12 TiB ARC files
  • July 2009 - Sept 2010 (crawl-002), Nutch
    • 29 TiB ARC files
  • Jan 2012 - June 2012, commoncrawl-crawler,
    • 89 TiB ARC files
    • text and metadata extracts (Hadoop sequence files)

The conversion of ARC data to the WARC format is motivated by

  • low (and further dropping) support for the ARC file format by data and text processing tools
  • bugs and glitches in the ARC files written by CCF's crawler software

Several format issues in the ARC files were detected in 2019 when the ARC data was indexed using warcio and PyWB. The indexing succeeded after some modifications and work-arounds were made.

Mostly open questions are

  • the conversion and transfer of metadata from ARC to WARC, both on the record and file level ("warcinfo" record)
  • crawl/fetch metadata stored in HTTP headers
  • and the required rewriting of HTTP headers
  • whether to convert file by file or to group 10 ARC files into one WARC to meet the 1 GB WARC files size recommendation) (100 MB for ARC)

References and Documentation

The 2008 - 2012 Archives

The ARC File Format

The WARC File Format

ARC to WARC Conversion Software

Principally, any software able to read ARC and write WARC can be used. We focus on warcio and jwarc.

WARC Validation Software

(if not listed as ARC-to-WARC conversion software)

Feature matrix (March 2025):

warcio jwarc FastWARC warc-tiny
Software version 1.7.5 0.31.1 0.15.1 579d589
Validates also ARC
WARC-Block-Digest
WARC-Payload-Digest
WARC-Target-URI

Format Issues in Common Crawl ARC Files

Issues Discovered 2019 While Indexing ARC Data

  1. invalid URIs causing SURT canonicalization to fail

    • seen in crawl-002 (2009/2010)
    • examples
      http://www.babelicious.com%3Fnats=stiff7788:partner:BBLCS,0,0,0,0
      http://www.insuranceforpets.net]www.insuranceforpets.net/
      
    • fixed in pywb/utils/canonicalize.py
      1. try to fix the URL (2103a7d)
      2. do not fail but skip (6dc9c39)
    • test resources
      • test/resources/arc/crawl-002_2009_09_17_12_1253241189984_12-4827319.arc.gz (s3://commoncrawl/crawl-002/2009/09/17/12/1253241189984_12.arc.gz, offset 4827319, length 4260)
      • test/resources/arc/crawl-002_2010_02_16_114_1266352769711_14-7060652.arc.gz (s3://commoncrawl/crawl-002/2010/02/16/14/1266352769711_14.arc.gz, offset 7060652, length 1959)
  2. white space in URLs breaks ARC header

    • seen in 2012 crawl
    • fixed in warcio/recordloader.py (a8a0014)
    • notes:
      • the URL spec (RFC 1738) and the living WHATWG URL standard do not allow white space in URLs. However, the Java URL class does not complain, while the Java URI class does. Such, white space in URLs is a common issue in Java-based crawlers.
      • while the ARC descriptions use "URLs", the WARC spec requires a URI (WARC-Target-URI)
      • test resources
        • test/resources/arc/crawl-2012_1341690165832_1341699469441_1478-7224105.arc.gz (s3://commoncrawl/parse-output/segment/1341690165832/1341699469441_1478.arc.gz, offset 7224105, length 10280)
  3. wrong content-length in ARC header

Note: issues 2 and 3 have already been fixed in 2012 after they where reported on CCF's discussion group. However, the policy was to keep the erroneous ARC files in place but to not include them in a list of "valid ARC files". Erroneously, also the outdated ARC files were tried to index in 2019 in the first pass. That way the issues were "rediscovered" in 2019.

Commands to Convert an ARC into a WARC File

If not specified otherwise, all commands in this and following section use these shell variables:

ARC_FILE=test/resources/arc/crawl-002_2010_02_16_114_1266352769711_14-7060652.arc.gz
WARC_FILE=test/output/warc/$(basename $arc_file .arc.gz).warc.gz
  • warcio
    warcio recompress --verbose $ARC_FILE $WARC_FILE
    

Commands to Validate WARC Files

  • warcio check --verbose $WARC_FILE
  • fastwarc check --verify-payloads $WARC_FILE
  • java -jar jwarc-0.31.1.jar validate --verbose $WARC
  • warc-tiny verify $WARC

ARC and WARC Metadata

Metadata stored in HTTP headers of ARC records

Required Rewriting of HTTP Headers

CCF's ARC and WARC files store the payload with content and transfer encodings removed. However, in the ARC files the HTTP headers Content-Encoding and Transfer-Encoding are preserved, e.g.

Content-Encoding:gzip
Transfer-Encoding:chunked

This was also the case for CCF WARC files written in 2013 – 2016/2018 and caused troubles with WARC parsers trying to decode the content or transfer encoding:

About

Experiences converting Common Crawl's ARC files from the crawls 2008 - 2012 to the WARC format

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published