view bin/count_warc.py @ 83:d92bd8527718

use surt instead of trying to create index term by hand
author Henry Thompson <ht@markup.co.uk>
date Sat, 19 Aug 2023 16:33:23 -0400
parents 083229195d12
children
line wrap: on
line source

#!/usr/bin/env python3
import warc,sys

OUT=open(sys.stdout.fileno(),'wb')

if (debug:=(sys.argv[1]=='-d')):
  sys.argv.pop(1)

def countme(wtype,buf,part):
  if debug:
    breakpoint()
  OUT.write(b"%d\n"%len(buf))

#warc(showme,[b'response','warcinfo','request','metadata'],int(sys.argv[2]))
#warc(showme,[b'response'],whole=True)

warc.warc(sys.argv[1],countme,[b'response'],parts=int(sys.argv[2]),debug=debug)