1
0
mirror of https://github.com/instaloader/instaloader.git synced 2024-10-02 13:27:07 +02:00

Add login required message when getting comments (#2237)

The comment function in the command line options documentation and the main program file has been edited to state that it now requires login. This change was crucial as the additional requests to Instagram server made for each post necessitate user authentication.
This commit is contained in:
Hector Oliveros 2024-05-12 14:16:36 -04:00 committed by GitHub
parent 1fb98b066a
commit 98791fb0aa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 2 deletions

View File

@ -67,7 +67,7 @@ What to Download of each Post
Download and update comments for each post. This requires an additional
request to the Instagram server for each post, which is why it is disabled by
default.
default. Requires :option:`--login`.
.. option:: --no-captions

View File

@ -367,7 +367,7 @@ def main():
g_post.add_argument('-C', '--comments', action='store_true',
help='Download and update comments for each post. '
'This requires an additional request to the Instagram '
'server for each post, which is why it is disabled by default.')
'server for each post, which is why it is disabled by default. Requires --login.')
g_post.add_argument('--no-captions', action='store_true',
help='Do not create txt files.')
g_post.add_argument('--post-metadata-txt', action='append',

View File

@ -685,6 +685,9 @@ class Post:
.. versionchanged:: 4.7
Change return type to ``Iterable``.
"""
if not self._context.is_logged_in:
raise LoginRequiredException("--login required to access comments of a post.")
def _postcommentanswer(node):
return PostCommentAnswer(id=int(node['id']),
created_at_utc=datetime.utcfromtimestamp(node['created_at']),