27 lines
577 B
Python
27 lines
577 B
Python
import requests
|
|
import json
|
|
import os
|
|
|
|
from os.path import exists
|
|
|
|
pads_json = []
|
|
new_json= []
|
|
|
|
if exists("pads.json"):
|
|
with open("pads.json", "r") as f:
|
|
old_file = json.load(f)
|
|
|
|
pads_json.extend(old_file)
|
|
|
|
for pad in pads_json:
|
|
print("Downloading: " + pad['oldUrl'] + "/download")
|
|
r = requests.head(pad['oldUrl'] + "/download")
|
|
if int(r.headers['content-length']) > 150:
|
|
new_json.append(pad)
|
|
|
|
|
|
with open("new_pads.json", "w") as f:
|
|
f.write(json.dumps(new_json))
|
|
|
|
else:
|
|
print("Give me pads.json")
|