Compare commits

...
3 Commits
Author SHA1 Message Date
Alexander Graf 9ae7b23939 Release of version 3.0 2017-09-01 16:01:51 +02:00
Alexander Graf 9dc7456edb Let caption_hashtags return lowercased hashtags
This is more useful, since hashtags should be matched
case-insensitively.
2017-08-30 10:02:45 +02:00
Alexander Graf 12d34143c2 very minor documentation fixes 2017-08-30 09:50:26 +02:00
2 changed files with 7 additions and 15 deletions
+2 -10
View File
@@ -83,7 +83,7 @@ may specify the following targets:
- ``:feed``: Your **feed** (requires ``--login``),
- ``@profile``: All profiles which are followed by ``profile``, i.e. the
- ``@profile``: All profiles that are followed by ``profile``, i.e. the
*followees* of ``profile`` (requires ``--login``).
Instaloader goes through all media matching the specified targets and
@@ -332,7 +332,7 @@ a certain source.
for post in loader.get_hashtag_posts('cat'):
# post is an instance of instaloader.Post
self.download_post(post, target='#cat')
loader.download_post(post, target='#cat')
Each Instagram profile has its own unique ID which stays unmodified even
if a user changes his/her username. To get said ID, given the profile's
@@ -342,14 +342,6 @@ name, you may call
loader.get_id_by_username(PROFILE_NAME)
``get_followees()`` also returns unique IDs for all loaded followees. To
get the current username of a profile, given this unique ID
``get_username_by_id()`` can be used. For example:
.. code:: python
loader.get_username_by_id(loader.get_followees()[0]['id'])
.. as-module-intro-end
Refer to the
+5 -5
View File
@@ -29,7 +29,7 @@ import requests.utils
import urllib3
__version__ = '3.0rc1'
__version__ = '3.0'
try:
@@ -277,13 +277,13 @@ class Post:
@property
def caption_hashtags(self) -> List[str]:
"""List of all hashtags (without preceeding #) which 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:
@@ -461,7 +461,7 @@ class Instaloader:
session: Optional[requests.Session] = None, tries: int = 3) -> Dict[str, Any]:
"""JSON request to Instagram.
:param url: URL, relative to https://www.instagram.com/
:param url: URL, relative to www.instagram.com/
:param params: GET parameters
:param session: Session to use, or None to use self.session
:param tries: Maximum number of attempts until an exception is raised
@@ -770,7 +770,7 @@ class Instaloader:
If filename is None, the file with the default session path is loaded.
:raises FileNotFoundError; If the file does not exist.
:raises FileNotFoundError: If the file does not exist.
"""
if filename is None:
filename = get_default_session_filename(username)