mirror of
https://github.com/instaloader/instaloader.git
synced 2024-09-11 16:22:24 +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
|
@property
|
||||||
def caption_hashtags(self) -> List[str]:
|
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:
|
if not self.caption:
|
||||||
return []
|
return []
|
||||||
# This regular expression is from jStassen, adjusted to use Python's \w to support Unicode
|
# 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/
|
# http://blog.jstassen.com/2016/03/code-regex-for-instagram-username-and-hashtags/
|
||||||
hashtag_regex = re.compile(r"(?:#)(\w(?:(?:\w|(?:\.(?!\.))){0,28}(?:\w))?)")
|
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
|
@property
|
||||||
def is_video(self) -> bool:
|
def is_video(self) -> bool:
|
||||||
|
Loading…
Reference in New Issue
Block a user