Allow extract amazon host and asin for https

This commit is contained in:
barami
2016-10-16 14:01:54 +09:00
parent cb9b6294e2
commit 7d35cdf40a

View File

@@ -213,7 +213,7 @@ def parse_amazon_url(url):
"""Extract host and asin from an amazon url.
It returns a dict with host and asin keys on success, None else
"""
r = re.compile(r'^http://(?:www.)?(?P<host>.*?)(?:\:[0-9]+)?/.*/(?P<asin>[0-9B][0-9A-Z]{9})(?:[^0-9A-Z]|$)')
r = re.compile(r'^(http|https)://(?:www.)?(?P<host>.*?)(?:\:[0-9]+)?/.*/(?P<asin>[0-9B][0-9A-Z]{9})(?:[^0-9A-Z]|$)')
match = r.match(url)
if match is not None:
return match.groupdict()