Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add [[Category:Videos of %(yyyy)s|%(mm_dd)s]] #171

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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