aboutsummaryrefslogtreecommitdiffstats
path: root/python/fatcat_web/hacks.py
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-04-09 13:07:05 -0700
committerBryan Newbold <bnewbold@robocracy.org>2019-04-09 13:07:05 -0700
commitff4d9cf06955aaa21a429ff10456468e1fae84fc (patch)
tree9078e548422ccc99dac54967609031f424448f00 /python/fatcat_web/hacks.py
parente7229e06bd8af4e97f5a5494e89ee66fbdb607ee (diff)
downloadfatcat-ff4d9cf06955aaa21a429ff10456468e1fae84fc.tar.gz
fatcat-ff4d9cf06955aaa21a429ff10456468e1fae84fc.zip
have webcapture wayback links go right to capture (not calendar)
Diffstat (limited to 'python/fatcat_web/hacks.py')
-rw-r--r--python/fatcat_web/hacks.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/python/fatcat_web/hacks.py b/python/fatcat_web/hacks.py
index 51b97142..9e6f6ab5 100644
--- a/python/fatcat_web/hacks.py
+++ b/python/fatcat_web/hacks.py
@@ -13,3 +13,15 @@ def test_strip_extlink_xml():
assert strip_extlink_xml("""LOCKSS (2014) Available: <ext-link xmlns:xlink="http://www.w3.org/1999/xlink" ext-link-type="uri" xlink:href="http://lockss.org/" xlink:type="simple">http://lockss.org/</ext-link>. Accessed: 2014 November 1.""") == \
"""LOCKSS (2014) Available: http://lockss.org/. Accessed: 2014 November 1."""
+def wayback_suffix(entity):
+ """
+ Takes a webcapture entity and returns a suffix to be appended to wayback URLs
+ """
+ ret = ""
+ if entity.original_url:
+ if entity.timestamp:
+ ret = entity.timestamp.strftime("%Y%m%d%H%M%S/")
+ else:
+ ret = "*/"
+ ret += entity.original_url
+ return ret