Replace old pages with new ones
This commit is contained in:
parent
d374cf9690
commit
219ab35571
32 changed files with 509 additions and 3698 deletions
61
mention.py
Normal file
61
mention.py
Normal file
|
@ -0,0 +1,61 @@
|
|||
import datetime,os,requests
|
||||
from importlib import import_module
|
||||
|
||||
def stringno(theno):
|
||||
if theno < 10:
|
||||
return "00" + str(theno)
|
||||
elif theno < 100:
|
||||
return "0" + str(theno)
|
||||
else:
|
||||
return str(theno)
|
||||
|
||||
ficlist = []
|
||||
|
||||
ficcount = 999
|
||||
while ficcount > 0:
|
||||
ficcount -= 1
|
||||
ficcountstring = stringno(ficcount)
|
||||
if os.path.exists("files/originalsmeta/" + ficcountstring + ".py"):
|
||||
ficfile = "files.originalsmeta." + ficcountstring
|
||||
fileread = import_module(ficfile)
|
||||
try:
|
||||
if fileread.revealdate <= datetime.datetime.now():
|
||||
goahead = True
|
||||
else:
|
||||
goahead = False
|
||||
except:
|
||||
goahead = True
|
||||
if goahead == True:
|
||||
ficdict = {}
|
||||
ficdict["id"] = stringno(ficcount)
|
||||
ficdict["date"] = fileread.datewords[-1]["date"]
|
||||
ficlist.append(ficdict)
|
||||
elif os.path.exists("files/translationsmeta/" + ficcountstring + ".py"):
|
||||
ficfile = "files.translationsmeta." + ficcountstring
|
||||
fileread = import_module(ficfile)
|
||||
try:
|
||||
if fileread.revealdate <= datetime.datetime.now():
|
||||
goahead = True
|
||||
else:
|
||||
goahead = False
|
||||
except:
|
||||
goahead = True
|
||||
if goahead == True:
|
||||
ficdict = {}
|
||||
ficdict["id"] = stringno(ficcount)
|
||||
ficdict["date"] = fileread.datewords[-1]["date"]
|
||||
ficlist.append(ficdict)
|
||||
|
||||
mentionlist = []
|
||||
|
||||
for fic in ficlist:
|
||||
timeelapsed = datetime.datetime.now() - fic["date"]
|
||||
if timeelapsed.days < 8:
|
||||
mentionlist.append(fic["id"])
|
||||
|
||||
headers = {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
}
|
||||
|
||||
for fic in mentionlist:
|
||||
response = requests.post("https://fed.brid.gy/webmention", headers=headers, data="source=https://tre.praze.net/fic/" + str(fic) + "&target=https://fed.brid.gy/")
|
Loading…
Add table
Add a link
Reference in a new issue