From 6d9e86ed521276c62247d48f11e5a7aaa12c53c7 Mon Sep 17 00:00:00 2001 From: Jan Szejko Date: Thu, 5 Apr 2018 14:59:24 +0200 Subject: [PATCH] accept public domain on Flickr --- apps/cover/utils.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/cover/utils.py b/apps/cover/utils.py index f1cdcc96..51aee190 100755 --- a/apps/cover/utils.py +++ b/apps/cover/utils.py @@ -38,8 +38,16 @@ def get_flickr_data(url): re_license = re.compile(r'https?://creativecommons.org/licenses/([^/]*)/([^/]*)/.*') m = re_license.match(license_url) if not m: - raise FlickrError('License does not look like CC: %s' % license_url) - license_name = 'CC %s %s' % (m.group(1).upper(), m.group(2)) + re_pd = re.compile(r'https?://creativecommons.org/publicdomain/([^/]*)/([^/]*)/.*') + m = re_pd.match(license_url) + if not m: + raise FlickrError('License does not look like CC: %s' % license_url) + if m.group(1).lower() == 'zero': + license_name = 'Public domain (CC0 %s)' % m.group(2) + else: + license_name = 'Public domain' + else: + license_name = 'CC %s %s' % (m.group(1).upper(), m.group(2)) m = re.search(r']* class="owner-name [^>]*>([^<]*)<', html) if m: author = "%s@Flickr" % m.group(1) -- 2.20.1