Added archiver

This commit is contained in:
thecookingsenpai 2024-01-12 21:11:13 +01:00
parent e6e6e29b9e
commit 7f3f153429
2 changed files with 14 additions and 0 deletions

11
archiver.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
DSTRING=$(date +%F)
# first, strip underscores
CLEAN=${DSTRING//_/}
# next, replace spaces with underscores
CLEAN=${CLEAN// /_}
# now, clean out anything that's not alphanumeric or an underscore
CLEAN=${CLEAN//[^a-zA-Z0-9_]/}
# finally, lowercase with TR
CLEAN=`echo -n $CLEAN | tr A-Z a-z`
cp allsides.html archive/$CLEAN.html

View File

@ -116,6 +116,9 @@ def main():
with open("allsides.html", "w+") as f:
f.write(html)
# Archiving (skip if causes errors)
os.system("./archiver.sh")
print("Total articles: ", len(all_data))
# Do some math to find the number of articles per bias rating
bias_ratings = {}