Added script to identify broken links

This commit is contained in:
Sebastian Lay 2022-11-11 17:22:13 +01:00
parent e1a3dcc04a
commit 20c5b985be
No known key found for this signature in database
GPG Key ID: A699D9B80D6068AA

18
scripts/broken-links.py Normal file
View File

@ -0,0 +1,18 @@
import json
import time
from urllib.request import urlopen
with open('js/current-films.js', mode='r') as file:
file_content = file.read()
films = json.loads(file_content[19:])
for film in films:
time.sleep(1)
if film['lomography']:
try:
with urlopen(film['lomography']) as response:
print(film['name'] + '')
except:
print(film['name'] + ' ✗ - ' + film['lomography'])