1. 18 Oct, 2017 1 commit
  2. 28 Jun, 2017 1 commit
    • Hans-Christoph Steiner's avatar
      include all images from Wordpress that are still used in posts · 528910fd
      Hans-Christoph Steiner authored
      Aka the 'wp-content' folder. This script was used to scrape this:
      #!/usr/bin/env python3
      import re, os, glob, subprocess
      for d in glob.glob('/home/hans/code/fdroid/fdroid-website/_*'):
          for root, dirs, files in os.walk(d):
              if root.endswith('.git'):
              for f in files:
                  if f[-3:] in ('png', 'peg', 'jpg', 'ttf', 'svg', 'gif'):
                  with open(os.path.join(root, f), encoding='utf-8') as fp:
                      data = fp.read()
                  for m in re.finditer(r'(https://f-droid.org/wp-[^ "]+)', data):
                      url = m.group(1)
                      dldir = os.path.dirname(url.replace('https://f-droid.org/', ''))
                      print('URL', url, dldir)
                      os.makedirs(dldir, exist_ok=True)
                      subprocess.call(['wget', '--continue', url,
                                       '--output-document', url.replace('https://f-droid.org/', '')])