• Hans-Christoph Steiner's avatar
    include all images from Wordpress that are still used in posts · 95bcfc07
    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'):
                continue
            for f in files:
                if f[-3:] in ('png', 'peg', 'jpg', 'ttf', 'svg', 'gif'):
                    continue
                #print(f)
                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/', '')])
    95bcfc07
Name
Last commit
Last update
..
downloaded-updates-100x201.png Loading commit data...
downloaded-updates-149x300.png Loading commit data...
downloaded-updates-150x302.png Loading commit data...
downloaded-updates-200x402.png Loading commit data...
downloaded-updates-300x603.png Loading commit data...
downloaded-updates-450x905.png Loading commit data...
downloaded-updates-509x1024.png Loading commit data...
downloaded-updates-600x1207.png Loading commit data...
downloaded-updates-768x1544.png Loading commit data...
downloaded-updates-900x1810.png Loading commit data...
downloaded-updates.png Loading commit data...
pref-auto-download-updates-100x201.png Loading commit data...
pref-auto-download-updates-149x300.png Loading commit data...
pref-auto-download-updates-150x302.png Loading commit data...
pref-auto-download-updates-200x402.png Loading commit data...
pref-auto-download-updates-300x603.png Loading commit data...
pref-auto-download-updates-450x905.png Loading commit data...
pref-auto-download-updates-509x1024.png Loading commit data...
pref-auto-download-updates-600x1207.png Loading commit data...
pref-auto-download-updates-768x1544.png Loading commit data...
pref-auto-download-updates-900x1810.png Loading commit data...
pref-auto-download-updates.png Loading commit data...