diff --git a/archiver.sh b/archiver.sh new file mode 100755 index 0000000..e70dbe5 --- /dev/null +++ b/archiver.sh @@ -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 diff --git a/main.py b/main.py index fe8268d..fc81ef1 100644 --- a/main.py +++ b/main.py @@ -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 = {}