Skip to content

Instantly share code, notes, and snippets.

@jinie
Last active December 19, 2015 18:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jinie/5996642 to your computer and use it in GitHub Desktop.
Save jinie/5996642 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import re
import sys
from functools import partial
remainder = ""
bufsize=4096
ex = re.compile('"(?:url|referer)"\:"([^"]*)"')
with open(sys.argv[1]) as f:
for buf in iter(partial(f.read,bufsize),""):
buf = remainder + buf
remainder = ""
endpos = 0
for m in ex.finditer(buf):
print m.group(1)
endpos = m.end()
remainder = buf[endpos:]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment