mirror of
https://github.com/instaloader/instaloader.git
synced 2024-08-17 12:19:38 +02:00
Let caption_hashtags return lowercased hashtags
This is more useful, since hashtags should be matched case-insensitively.
This commit is contained in:
parent
12d34143c2
commit
9dc7456edb
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user