14 lines
534 B
Python
14 lines
534 B
Python
"""Stable identities from publisher-owned metadata self-links."""
|
|
import re
|
|
from urllib.parse import urlsplit
|
|
|
|
|
|
def mlsys_id(url):
|
|
parsed = urlsplit(url)
|
|
if parsed.scheme not in ('https', 'http') or parsed.netloc != 'proceedings.mlsys.org':
|
|
return None
|
|
match = re.fullmatch(r'/paper(?:_files/paper)?/((?:19|20)\d{2})/hash/([a-f0-9]{32})-Abstract(?:-(?:Conference|mlsys(20\d{2})))?\.html', parsed.path)
|
|
if not match or match[3] and match[3] != match[1]:
|
|
return None
|
|
return match[1] + '/' + match[2]
|