Created
October 9, 2019 13:07
-
-
Save sebastian-nagel/96cb4b94962008c70d3e89b96da7c27c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from warcio.archiveiterator import ArchiveIterator | |
with open('path/to/file.wet.gz', 'rb') as stream: | |
for record in ArchiveIterator(stream): | |
if record.rec_type == 'conversion': | |
url = record.rec_headers.get_header('WARC-Target-URI') | |
text = record.content_stream().read().decode('utf-8') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment