From 9dc7456edbcd6cd932b3b4ebe42882161585a365 Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Wed, 30 Aug 2017 10:02:45 +0200 Subject: [PATCH] Let caption_hashtags return lowercased hashtags This is more useful, since hashtags should be matched case-insensitively. --- instaloader.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/instaloader.py b/instaloader.py index dce2a43..0d432a4 100755 --- a/instaloader.py +++ b/instaloader.py @@ -277,13 +277,13 @@ class Post: @property def caption_hashtags(self) -> List[str]: - """List of all hashtags (without preceeding #) that occur in the Post's caption.""" + """List of all lowercased hashtags (without preceeding #) that occur in the Post's caption.""" if not self.caption: return [] # This regular expression is from jStassen, adjusted to use Python's \w to support Unicode # http://blog.jstassen.com/2016/03/code-regex-for-instagram-username-and-hashtags/ hashtag_regex = re.compile(r"(?:#)(\w(?:(?:\w|(?:\.(?!\.))){0,28}(?:\w))?)") - return re.findall(hashtag_regex, self.caption) + return re.findall(hashtag_regex, self.caption.lower()) @property def is_video(self) -> bool: