Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions video2commons/frontend/urlextract.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
{{LicenseReview}}

[[Category:Uploaded with video2commons]]
[[Category:Videos of %(yyyy)s|%(mmdd)s]]
"""


Expand Down Expand Up @@ -102,7 +103,9 @@ def do_extract_url(url):
'date': _date(url, ie_key, title, info),
'source': _source(url, ie_key, title, info),
'uploader': _uploader(url, ie_key, title, info),
'license': _license(url, ie_key, title, info)
'license': _license(url, ie_key, title, info),
'yyyy': _date(url, ie_key, title, info)[1],
'mmdd': _date(url, ie_key, title, info)[2]
}

return {
Expand All @@ -115,9 +118,15 @@ def do_extract_url(url):

def _date(url, ie_key, title, info):
date = (info.get('upload_date') or '').strip()
yyyy = ''
mmdd = ''

if re.match(r'^[0-9]{8}$', date):
yyyy = date[0:4]
mmdd = date[4:8]
date = '%s-%s-%s' % (date[0:4], date[4:6], date[6:8])
return date

return date, yyyy, mmdd


def _source(url, ie_key, title, info):
Expand Down