mirror of
https://github.com/instaloader/instaloader.git
synced 2026-10-29 20:51:57 -07:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dcea0e9672 | ||
|
|
809b23a996 | ||
|
|
c634f21dcc | ||
|
|
a070ed42ae | ||
|
|
a34d750152 | ||
|
|
bfa5d8ed41 | ||
|
|
7f81985911 | ||
|
|
b5aa268344 | ||
|
|
92653dcdb9 | ||
|
|
1b5c12c8fa | ||
|
|
bc29ffbd44 | ||
|
|
50a5330fec | ||
|
|
1739844758 | ||
|
|
0ebb223214 | ||
|
|
3d4109ded3 | ||
|
|
8423e3bd00 | ||
|
|
5b0f8b75cc | ||
|
|
3cb33603e5 | ||
|
|
47db7f7ffa | ||
|
|
2567bec975 | ||
|
|
2df1419d68 | ||
|
|
8211c9daf1 | ||
|
|
969d4e3aa4 | ||
|
|
4cf1ae847d |
+1
-1
@@ -8,7 +8,7 @@ install:
|
|||||||
- pip install pylint requests
|
- pip install pylint requests
|
||||||
- pip install -r docs/requirements.txt
|
- pip install -r docs/requirements.txt
|
||||||
script:
|
script:
|
||||||
- python3 -m pylint -r n -d bad-whitespace,missing-docstring,too-many-arguments,locally-disabled,line-too-long,too-many-public-methods,too-many-lines,too-many-instance-attributes,too-many-locals,too-many-branches,too-many-statements,inconsistent-return-statements,invalid-name,wildcard-import,unused-wildcard-import instaloader
|
- python3 -m pylint -r n -d bad-whitespace,missing-docstring,too-many-arguments,locally-disabled,line-too-long,too-many-public-methods,too-many-lines,too-many-instance-attributes,too-many-locals,too-many-branches,too-many-statements,inconsistent-return-statements,invalid-name,wildcard-import,unused-wildcard-import,no-else-return instaloader
|
||||||
- make -C docs html SPHINXOPTS="-W -n"
|
- make -C docs html SPHINXOPTS="-W -n"
|
||||||
deploy:
|
deploy:
|
||||||
- provider: pypi
|
- provider: pypi
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
Authors
|
||||||
|
=======
|
||||||
|
|
||||||
|
Instaloader is written by
|
||||||
|
|
||||||
|
- Alexander Graf (@aandergr)
|
||||||
|
- André Koch-Kramer (@Thammus)
|
||||||
|
- Lars Lindqvist (@e5150)
|
||||||
+28
-1
@@ -75,6 +75,33 @@ Disclaimer
|
|||||||
Instaloader is in no way affiliated with, authorized, maintained or endorsed by Instagram or any of its affiliates or
|
Instaloader is in no way affiliated with, authorized, maintained or endorsed by Instagram or any of its affiliates or
|
||||||
subsidiaries. This is an independent and unofficial project. Use at your own risk.
|
subsidiaries. This is an independent and unofficial project. Use at your own risk.
|
||||||
|
|
||||||
|
Instaloader is licensed under an MIT license. Refer to ``LICENSE`` file for more information.
|
||||||
|
|
||||||
.. disclaimer-end
|
.. disclaimer-end
|
||||||
|
|
||||||
Instaloader is licensed under an MIT license. Refer to ``LICENSE`` file for more information.
|
Contributing
|
||||||
|
------------
|
||||||
|
|
||||||
|
As an open source project, Instaloader heavily depends on the contributions from
|
||||||
|
its community. See
|
||||||
|
`contributing <https://instaloader.github.io/contributing.html>`__
|
||||||
|
for how you may help Instaloader to become an even greater tool.
|
||||||
|
|
||||||
|
It is a pleasure for us to share our Instaloader to the world, and we are proud
|
||||||
|
to have attracted such an active and motivating community, with so many users
|
||||||
|
who share their suggestions and ideas with us. Buying a community-sponsored beer
|
||||||
|
or coffee from time to time is very likely to further raise our passion for the
|
||||||
|
development of Instaloader.
|
||||||
|
|
||||||
|
| For Donations, we provide a PayPal.Me link and a Bitcoin address.
|
||||||
|
| PayPal: `PayPal.me/aandergr <https://www.paypal.me/aandergr>`__
|
||||||
|
| BTC: 1Nst4LoadeYzrKjJ1DX9CpbLXBYE9RKLwY
|
||||||
|
|
||||||
|
For a direct and personal communication within Instaloader's community, we have
|
||||||
|
an IRC channel
|
||||||
|
|
||||||
|
**#instaloader** on **Freenode**.
|
||||||
|
|
||||||
|
Freenode provides a `Web IRC Client
|
||||||
|
<https://webchat.freenode.net/?channels=instaloader>`__, allowing to join our
|
||||||
|
channel without having an IRC client installed.
|
||||||
|
|||||||
Vendored
+8
@@ -10,3 +10,11 @@ dd {
|
|||||||
dl.option dd {
|
dl.option dd {
|
||||||
padding-left: 12px;
|
padding-left: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #008d06;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
color: #f48400;
|
||||||
|
}
|
||||||
|
|||||||
Vendored
+2
@@ -50,6 +50,8 @@
|
|||||||
<li><a href="https://github.com/instaloader/instaloader">Instaloader on GitHub</a></li>
|
<li><a href="https://github.com/instaloader/instaloader">Instaloader on GitHub</a></li>
|
||||||
<li role="separator" class="divider"></li>
|
<li role="separator" class="divider"></li>
|
||||||
<li style="padding-left: 20px;"><a class="github-button" href="https://github.com/instaloader/instaloader" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star Instaloader on GitHub">Star</a></li>
|
<li style="padding-left: 20px;"><a class="github-button" href="https://github.com/instaloader/instaloader" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star Instaloader on GitHub">Star</a></li>
|
||||||
|
<li role="separator" class="divider"></li>
|
||||||
|
<li><a href="https://www.paypal.me/aandergr"><b>Donate (via Paypal)</b></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ Instaloader supports the following targets:
|
|||||||
**download the user's stories**.
|
**download the user's stories**.
|
||||||
|
|
||||||
- ``"#hashtag"``
|
- ``"#hashtag"``
|
||||||
Posts with a certain **hashtag** (the quotes are usually neccessary),
|
Posts with a certain **hashtag** (the quotes are usually necessary),
|
||||||
|
|
||||||
- ``:stories``
|
- ``:stories``
|
||||||
The currently-visible **stories** of your followees (requires
|
The currently-visible **stories** of your followees (requires
|
||||||
@@ -158,7 +158,7 @@ Filter Posts
|
|||||||
.. py:currentmodule:: instaloader
|
.. py:currentmodule:: instaloader
|
||||||
|
|
||||||
The options :option:`--post-filter` and :option:`--storyitem-filter`
|
The options :option:`--post-filter` and :option:`--storyitem-filter`
|
||||||
allows to specify criterias that posts or story items have to
|
allows to specify criteria that posts or story items have to
|
||||||
meet to be downloaded. If not given, all posts are downloaded.
|
meet to be downloaded. If not given, all posts are downloaded.
|
||||||
|
|
||||||
The filter string must be a
|
The filter string must be a
|
||||||
|
|||||||
+44
-21
@@ -11,8 +11,8 @@ Advanced Instaloader Examples
|
|||||||
:backlinks: none
|
:backlinks: none
|
||||||
|
|
||||||
Here we present code examples that use the :ref:`python-module-instaloader` for
|
Here we present code examples that use the :ref:`python-module-instaloader` for
|
||||||
more advanced tasks than what is possible with the Instaloader command line
|
more advanced Instagram downloading or metadata mining than what is possible
|
||||||
interface.
|
with the Instaloader command line interface.
|
||||||
|
|
||||||
.. For each code snippet:
|
.. For each code snippet:
|
||||||
- title
|
- title
|
||||||
@@ -21,12 +21,12 @@ interface.
|
|||||||
- link to discussion issue
|
- link to discussion issue
|
||||||
- link used methods
|
- link used methods
|
||||||
|
|
||||||
Download Posts in a specific period
|
Download Posts in a Specific Period
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
|
|
||||||
To collect pictures (and metadata) only from a specific period, you can play
|
To only download Instagram pictures (and metadata) that are within a specific
|
||||||
around with :func:`~itertools.dropwhile` and :func:`~itertools.takewhile` from
|
period, you can play around with :func:`~itertools.dropwhile` and
|
||||||
:mod:`itertools` like in this snippet.
|
:func:`~itertools.takewhile` from :mod:`itertools` like in this snippet.
|
||||||
|
|
||||||
.. literalinclude:: codesnippets/121_since_until.py
|
.. literalinclude:: codesnippets/121_since_until.py
|
||||||
|
|
||||||
@@ -37,8 +37,8 @@ Discussed in :issue:`121`.
|
|||||||
Likes of a Profile / Ghost Followers
|
Likes of a Profile / Ghost Followers
|
||||||
------------------------------------
|
------------------------------------
|
||||||
|
|
||||||
To store inactive followers, i.e. followers that did not like any of your
|
To obtain a list of your inactive followers, i.e. followers that did not like
|
||||||
pictures, into a file you can use this approach.
|
any of your pictures, into a file you can use this approach.
|
||||||
|
|
||||||
.. literalinclude:: codesnippets/120_ghost_followers.py
|
.. literalinclude:: codesnippets/120_ghost_followers.py
|
||||||
|
|
||||||
@@ -51,10 +51,10 @@ Discussed in :issue:`120`.
|
|||||||
Track Deleted Posts
|
Track Deleted Posts
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
This script uses Instaloader to obtain a list of currently-online posts, and
|
This script uses Instaloader to obtain a list of currently-online Instagram and
|
||||||
generates the matching filename of each post. It outputs a list of posts which
|
compares it with the set of posts that you already have downloaded. It outputs
|
||||||
are online but not offline (i.e. not yet downloaded) and a list of posts which
|
a list of posts which are online but not offline (i.e. not yet downloaded) and a
|
||||||
are offline but not online (i.e. deleted in the profile).
|
list of posts which are offline but not online (i.e. deleted in the profile).
|
||||||
|
|
||||||
.. literalinclude:: codesnippets/56_track_deleted.py
|
.. literalinclude:: codesnippets/56_track_deleted.py
|
||||||
|
|
||||||
@@ -68,9 +68,9 @@ Only one Post per User
|
|||||||
|
|
||||||
To download only the one most recent post from each user, this snippet creates a
|
To download only the one most recent post from each user, this snippet creates a
|
||||||
:class:`set` that contains the users of which a post has already been
|
:class:`set` that contains the users of which a post has already been
|
||||||
downloaded. When iterating the posts, check whether the post's owner already is
|
downloaded. While iterating the posts, it checks whether the post's owner
|
||||||
in the set. If so, skip the post. Otherwise, download it and add the user to
|
already is in the set. If not, the post is downloaded from Instagram and the
|
||||||
that set.
|
user is added to that set.
|
||||||
|
|
||||||
.. literalinclude:: codesnippets/113_only_one_per_user.py
|
.. literalinclude:: codesnippets/113_only_one_per_user.py
|
||||||
|
|
||||||
@@ -79,23 +79,23 @@ See also :class:`Post`, :meth:`Instaloader.download_post`,
|
|||||||
|
|
||||||
Discussed in :issue:`113`.
|
Discussed in :issue:`113`.
|
||||||
|
|
||||||
Upgrade Images by local Copies
|
Upgrade Images by Local Copies
|
||||||
------------------------------
|
------------------------------
|
||||||
|
|
||||||
The following script finds local versions of images fetched by Instaloader, in
|
The following script finds local versions of images fetched by Instaloader, in
|
||||||
order to ugprade the downloaded images by locally-found versions with better
|
order to upgrade the downloaded images by locally-found versions with better
|
||||||
quality. It uses image hashing to identify similar images.
|
quality. It uses image hashing to identify similar images.
|
||||||
|
|
||||||
`updgrade-instaloader-images.py <https://gist.github.com/pavelkryukov/15f93d19a99428a284a8bcec27e0187b>`__ (external link to GitHub Gist)
|
`updgrade-instaloader-images.py <https://gist.github.com/pavelkryukov/15f93d19a99428a284a8bcec27e0187b>`__ (external link to GitHub Gist)
|
||||||
|
|
||||||
Discussed in :issue:`46`.
|
Discussed in :issue:`46`.
|
||||||
|
|
||||||
Render Captions to downloaded Images
|
Add Captions to Images
|
||||||
------------------------------------
|
----------------------
|
||||||
|
|
||||||
Instaloader does not modify the downloaded JPEG file. However, one could combine
|
Instaloader does not modify the downloaded JPEG file. However, one could combine
|
||||||
it with an imaging library such as Pillow or PIL to render the
|
it with an imaging library such as Pillow or PIL to render the caption on
|
||||||
:attr:`Post.caption` on pictures. The following shows an approach.
|
Instagram pictures. The following shows an approach.
|
||||||
|
|
||||||
.. literalinclude:: codesnippets/110_pil_captions.py
|
.. literalinclude:: codesnippets/110_pil_captions.py
|
||||||
|
|
||||||
@@ -103,3 +103,26 @@ See also :attr:`Post.caption`, :attr:`Post.url`, :meth:`Post.from_shortcode`,
|
|||||||
:func:`load_structure_from_file`.
|
:func:`load_structure_from_file`.
|
||||||
|
|
||||||
Discussed in :issue:`110`.
|
Discussed in :issue:`110`.
|
||||||
|
|
||||||
|
Metadata JSON Files
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
The JSON files Instaloader saves along with each Post contain all the metadata
|
||||||
|
that has been retrieved from Instagram while downloading the picture and
|
||||||
|
associated required information.
|
||||||
|
|
||||||
|
With `jq <https://stedolan.github.io/jq/>`__, a command-line JSON processor, the
|
||||||
|
metadata can be easily post-processed. For example, Instaloader's JSON files can
|
||||||
|
be pretty-formatted with:
|
||||||
|
|
||||||
|
.. code-block:: none
|
||||||
|
|
||||||
|
xzcat 2018-05-13_11-18-45_UTC.json.xz | jq .node
|
||||||
|
|
||||||
|
However, Instaloader tries to do as few metadata requests as possible, so,
|
||||||
|
depending on how Instaloader has been invoked, it may occur that these files do
|
||||||
|
not contain the complete available metadata structure. Nevertheless, the file
|
||||||
|
can be loaded into Instaloader with :func:`load_structure_from_file` and the
|
||||||
|
required metadata then be accessed via the :class:`Post` or :class:`Profile`
|
||||||
|
attributes, which trigger an Instagram request if that particular information is
|
||||||
|
not present in the JSON file.
|
||||||
|
|||||||
+43
-6
@@ -1,3 +1,5 @@
|
|||||||
|
.. _contributing:
|
||||||
|
|
||||||
Contributing to Instaloader
|
Contributing to Instaloader
|
||||||
===========================
|
===========================
|
||||||
|
|
||||||
@@ -15,7 +17,7 @@ Reporting Bugs
|
|||||||
If you encounter a bug, do not hesitate to report it in our
|
If you encounter a bug, do not hesitate to report it in our
|
||||||
`Issue Tracker <https://github.com/instaloader/instaloader/issues>`__. Since
|
`Issue Tracker <https://github.com/instaloader/instaloader/issues>`__. Since
|
||||||
Instaloader is actively developed, the majority of bugs is fixed within only
|
Instaloader is actively developed, the majority of bugs is fixed within only
|
||||||
**4 days** after being reported. When reporting a problem, please keep the
|
**3 days** after being reported. When reporting a problem, please keep the
|
||||||
following in mind:
|
following in mind:
|
||||||
|
|
||||||
- Ensure you **use the latest version** of Instaloader. The currently-installed
|
- Ensure you **use the latest version** of Instaloader. The currently-installed
|
||||||
@@ -23,10 +25,10 @@ following in mind:
|
|||||||
|
|
||||||
- Briefly **check whether the bug has already been reported**. If you find an
|
- Briefly **check whether the bug has already been reported**. If you find an
|
||||||
issue reporting the same bug you encountered, comment there rather than
|
issue reporting the same bug you encountered, comment there rather than
|
||||||
opening a new issue. However, if unsure, it is advised to create a new issue.
|
opening a new issue. However, if unsure, please create a new issue.
|
||||||
|
|
||||||
- State **how the bug can be reproduced**, i.e. how Instaloader was invoked
|
- State **how the bug can be reproduced**, i.e. how Instaloader was invoked
|
||||||
when the problem occured (of course, you may anonymize profile names etc.).
|
when the problem occurred (of course, you may anonymize profile names etc.).
|
||||||
|
|
||||||
- Include all **error messages and tracebacks** in the report.
|
- Include all **error messages and tracebacks** in the report.
|
||||||
|
|
||||||
@@ -47,13 +49,13 @@ few things to consider:
|
|||||||
you forked from the most recent branch.
|
you forked from the most recent branch.
|
||||||
|
|
||||||
- We use `Pylint <https://www.pylint.org/>`__ for error and syntax checking of
|
- We use `Pylint <https://www.pylint.org/>`__ for error and syntax checking of
|
||||||
``instaloader.py``. The file ``.travis.yml`` in the project's root directory
|
the source. The file ``.travis.yml`` in the project's root directory
|
||||||
shows how it is invoked. Note that sometimes it might be better to disable a
|
shows how it is invoked. Note that sometimes it might be better to disable a
|
||||||
warning rather than adapting the code to Pylint's desires.
|
warning rather than adapting the code to Pylint's desires.
|
||||||
|
|
||||||
- The documentation source is located in the ``docs`` folder. The file
|
- The documentation source is located in the ``docs`` folder. The file
|
||||||
``cli-options.rst`` is merely an RST-formatted copy of ``ìnstaloader --help``
|
``cli-options.rst`` is merely an RST-formatted copy of ``instaloader --help``
|
||||||
output, of which the source is near the bottom of ``instaloader.py``.
|
output, of which the source is in ``instaloader/__main__.py``.
|
||||||
|
|
||||||
- Feel free to contact us, even if you "only" have Proof-of-Concepts or
|
- Feel free to contact us, even if you "only" have Proof-of-Concepts or
|
||||||
not-fully integrated changes. They already might be an advance for the
|
not-fully integrated changes. They already might be an advance for the
|
||||||
@@ -81,3 +83,38 @@ Please consider the following:
|
|||||||
- **Be patient**. Naturally, bugs and pull requests have a higher priority than
|
- **Be patient**. Naturally, bugs and pull requests have a higher priority than
|
||||||
feature suggestions. Keep in mind that this is a free software project, and
|
feature suggestions. Keep in mind that this is a free software project, and
|
||||||
unfortunately we only have limited time to work on it.
|
unfortunately we only have limited time to work on it.
|
||||||
|
|
||||||
|
Donations
|
||||||
|
---------
|
||||||
|
|
||||||
|
.. donations-start
|
||||||
|
|
||||||
|
It is a pleasure for us to share our Instaloader to the world, and we are proud
|
||||||
|
to have attracted such an active and motivating community, with so many users
|
||||||
|
who share their suggestions and ideas with us. Buying a community-sponsored beer
|
||||||
|
or coffee from time to time is very likely to further raise our passion for the
|
||||||
|
development of Instaloader.
|
||||||
|
|
||||||
|
| For donations, we provide a PayPal.Me link and a Bitcoin address.
|
||||||
|
| `PayPal.me/aandergr <https://www.paypal.me/aandergr>`__
|
||||||
|
| BTC: 1Nst4LoadeYzrKjJ1DX9CpbLXBYE9RKLwY
|
||||||
|
|
||||||
|
.. donations-end
|
||||||
|
|
||||||
|
.. (Discussion in :issue:`130`)
|
||||||
|
|
||||||
|
IRC Channel
|
||||||
|
-----------
|
||||||
|
|
||||||
|
.. ircchannel-start
|
||||||
|
|
||||||
|
For a direct and personal communication within Instaloader's community, we have
|
||||||
|
an IRC channel
|
||||||
|
|
||||||
|
**#instaloader** on **Freenode**.
|
||||||
|
|
||||||
|
Freenode provides a `Web IRC Client
|
||||||
|
<https://webchat.freenode.net/?channels=instaloader>`__, allowing to join our
|
||||||
|
channel without having an IRC client installed.
|
||||||
|
|
||||||
|
.. ircchannel-end
|
||||||
|
|||||||
@@ -70,10 +70,27 @@ Useful Links
|
|||||||
- `Issue Tracker / Bug Tracker <https://github.com/instaloader/instaloader/issues>`__
|
- `Issue Tracker / Bug Tracker <https://github.com/instaloader/instaloader/issues>`__
|
||||||
- `Version History <https://github.com/instaloader/instaloader/releases>`__
|
- `Version History <https://github.com/instaloader/instaloader/releases>`__
|
||||||
|
|
||||||
|
Disclaimer
|
||||||
|
----------
|
||||||
|
|
||||||
.. include:: ../README.rst
|
.. include:: ../README.rst
|
||||||
:start-after: disclaimer-start
|
:start-after: disclaimer-start
|
||||||
:end-before: disclaimer-end
|
:end-before: disclaimer-end
|
||||||
|
|
||||||
|
Contributing
|
||||||
|
------------
|
||||||
|
|
||||||
|
As an open source project, Instaloader heavily depends on the contributions from
|
||||||
|
its community. See :ref:`contributing` for how you may help Instaloader to
|
||||||
|
become an even greater tool.
|
||||||
|
|
||||||
|
.. include:: contributing.rst
|
||||||
|
:start-after: donations-start
|
||||||
|
:end-before: donations-end
|
||||||
|
|
||||||
|
.. include:: contributing.rst
|
||||||
|
:start-after: ircchannel-start
|
||||||
|
:end-before: ircchannel-end
|
||||||
|
|
||||||
..
|
..
|
||||||
* :ref:`genindex`
|
* :ref:`genindex`
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"""Download pictures (or videos) along with their captions and other metadata from Instagram."""
|
"""Download pictures (or videos) along with their captions and other metadata from Instagram."""
|
||||||
|
|
||||||
|
|
||||||
__version__ = '4.0.4'
|
__version__ = '4.0.7'
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
+47
-21
@@ -90,6 +90,7 @@ def _main(instaloader: Instaloader, targetlist: List[str],
|
|||||||
instaloader.context.log("Logged in as %s." % username)
|
instaloader.context.log("Logged in as %s." % username)
|
||||||
# Try block for KeyboardInterrupt (save session on ^C)
|
# Try block for KeyboardInterrupt (save session on ^C)
|
||||||
profiles = set()
|
profiles = set()
|
||||||
|
anonymous_retry_profiles = set()
|
||||||
try:
|
try:
|
||||||
# Generate set of profiles, already downloading non-profile targets
|
# Generate set of profiles, already downloading non-profile targets
|
||||||
for target in targetlist:
|
for target in targetlist:
|
||||||
@@ -121,8 +122,9 @@ def _main(instaloader: Instaloader, targetlist: List[str],
|
|||||||
if target[0] == '@':
|
if target[0] == '@':
|
||||||
instaloader.context.log("Retrieving followees of %s..." % target[1:])
|
instaloader.context.log("Retrieving followees of %s..." % target[1:])
|
||||||
profile = Profile.from_username(instaloader.context, target[1:])
|
profile = Profile.from_username(instaloader.context, target[1:])
|
||||||
followees = profile.get_followees()
|
for followee in profile.get_followees():
|
||||||
profiles.update([followee.username for followee in followees])
|
instaloader.save_profile_id(followee)
|
||||||
|
profiles.add(followee)
|
||||||
elif target[0] == '#':
|
elif target[0] == '#':
|
||||||
instaloader.download_hashtag(hashtag=target[1:], max_count=max_count, fast_update=fast_update,
|
instaloader.download_hashtag(hashtag=target[1:], max_count=max_count, fast_update=fast_update,
|
||||||
post_filter=post_filter)
|
post_filter=post_filter)
|
||||||
@@ -135,26 +137,50 @@ def _main(instaloader: Instaloader, targetlist: List[str],
|
|||||||
instaloader.download_saved_posts(fast_update=fast_update, max_count=max_count,
|
instaloader.download_saved_posts(fast_update=fast_update, max_count=max_count,
|
||||||
post_filter=post_filter)
|
post_filter=post_filter)
|
||||||
else:
|
else:
|
||||||
profiles.add(target)
|
try:
|
||||||
|
profile = instaloader.check_profile_id(target)
|
||||||
|
if instaloader.context.is_logged_in and profile.has_blocked_viewer:
|
||||||
|
if not stories_only and not profile.is_private:
|
||||||
|
raise ProfileNotExistsException("{} blocked you; But she's public, "
|
||||||
|
"so we just download her anonymously.".format(target))
|
||||||
|
else:
|
||||||
|
instaloader.context.error("{} blocked you.".format(target))
|
||||||
|
else:
|
||||||
|
profiles.add(profile)
|
||||||
|
except ProfileNotExistsException as err:
|
||||||
|
# Not only our profile.has_blocked_viewer condition raises ProfileNotExistsException,
|
||||||
|
# check_profile_id() also does, since access to blocked profile may be responded with 404.
|
||||||
|
if instaloader.context.is_logged_in and not stories_only:
|
||||||
|
instaloader.context.log(err)
|
||||||
|
instaloader.context.log("Trying again anonymously, helps in case you are just blocked.")
|
||||||
|
with instaloader.anonymous_copy() as anonymous_loader:
|
||||||
|
with instaloader.context.error_catcher():
|
||||||
|
anonymous_retry_profiles.add(anonymous_loader.check_profile_id(target))
|
||||||
|
instaloader.context.log("Looks good.")
|
||||||
|
else:
|
||||||
|
raise
|
||||||
if len(profiles) > 1:
|
if len(profiles) > 1:
|
||||||
instaloader.context.log("Downloading {} profiles: {}".format(len(profiles), ' '.join(profiles)))
|
instaloader.context.log("Downloading {} profiles: {}".format(len(profiles),
|
||||||
# Iterate through profiles list and download them
|
' '.join([p.username for p in profiles])))
|
||||||
for target in profiles:
|
if not stories_only:
|
||||||
with instaloader.context.error_catcher(target):
|
# Iterate through profiles list and download them
|
||||||
try:
|
for target in profiles:
|
||||||
instaloader.download_profile(target, profile_pic, profile_pic_only, fast_update,
|
with instaloader.context.error_catcher(target):
|
||||||
stories, stories_only, post_filter=post_filter,
|
instaloader.download_profile(target, profile_pic, profile_pic_only,
|
||||||
storyitem_filter=storyitem_filter)
|
fast_update, post_filter=post_filter)
|
||||||
except ProfileNotExistsException as err:
|
if anonymous_retry_profiles:
|
||||||
if instaloader.context.is_logged_in:
|
instaloader.context.log("Downloading anonymously: {}"
|
||||||
instaloader.context.log(err)
|
.format(' '.join([p.username for p in anonymous_retry_profiles])))
|
||||||
instaloader.context.log("Trying again anonymously, helps in case you are just blocked.")
|
with instaloader.anonymous_copy() as anonymous_loader:
|
||||||
with instaloader.anonymous_copy() as anonymous_loader:
|
for target in anonymous_retry_profiles:
|
||||||
with instaloader.context.error_catcher():
|
with instaloader.context.error_catcher(target):
|
||||||
anonymous_loader.download_profile(target, profile_pic, profile_pic_only,
|
anonymous_loader.download_profile(target, profile_pic, profile_pic_only,
|
||||||
fast_update, post_filter=post_filter)
|
fast_update, post_filter=post_filter)
|
||||||
else:
|
if stories or stories_only:
|
||||||
raise
|
with instaloader.context.error_catcher("Download stories"):
|
||||||
|
instaloader.context.log("Downloading stories")
|
||||||
|
instaloader.download_stories(userids=list(profiles), fast_update=fast_update,
|
||||||
|
filename_target=None, storyitem_filter=storyitem_filter)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print("\nInterrupted by user.", file=sys.stderr)
|
print("\nInterrupted by user.", file=sys.stderr)
|
||||||
# Save session if it is useful
|
# Save session if it is useful
|
||||||
|
|||||||
+49
-28
@@ -11,7 +11,7 @@ from contextlib import contextmanager, suppress
|
|||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from typing import Callable, Iterator, List, Optional, Any
|
from typing import Any, Callable, Iterator, List, Optional, Union
|
||||||
|
|
||||||
from .exceptions import *
|
from .exceptions import *
|
||||||
from .instaloadercontext import InstaloaderContext
|
from .instaloadercontext import InstaloaderContext
|
||||||
@@ -49,11 +49,11 @@ class _ArbitraryItemFormatter(string.Formatter):
|
|||||||
def __init__(self, item: Any):
|
def __init__(self, item: Any):
|
||||||
self._item = item
|
self._item = item
|
||||||
|
|
||||||
def get_field(self, field_name, args, kwargs):
|
def get_value(self, key, args, kwargs):
|
||||||
"""Override to substitute {ATTRIBUTE} by attributes of our _item."""
|
"""Override to substitute {ATTRIBUTE} by attributes of our _item."""
|
||||||
if hasattr(self._item, field_name):
|
if hasattr(self._item, key):
|
||||||
return self._item.__getattribute__(field_name), None
|
return getattr(self._item, key)
|
||||||
return super().get_field(field_name, args, kwargs)
|
return super().get_value(key, args, kwargs)
|
||||||
|
|
||||||
def format_field(self, value, format_spec):
|
def format_field(self, value, format_spec):
|
||||||
"""Override :meth:`string.Formatter.format_field` to have our
|
"""Override :meth:`string.Formatter.format_field` to have our
|
||||||
@@ -270,14 +270,15 @@ class Instaloader:
|
|||||||
with self.context.get_anonymous_session() as anonymous_session:
|
with self.context.get_anonymous_session() as anonymous_session:
|
||||||
date_object = datetime.strptime(anonymous_session.head(profile_pic_url).headers["Last-Modified"],
|
date_object = datetime.strptime(anonymous_session.head(profile_pic_url).headers["Last-Modified"],
|
||||||
'%a, %d %b %Y %H:%M:%S GMT')
|
'%a, %d %b %Y %H:%M:%S GMT')
|
||||||
|
profile_pic_extension = 'jpg'
|
||||||
if ((format_string_contains_key(self.dirname_pattern, 'profile') or
|
if ((format_string_contains_key(self.dirname_pattern, 'profile') or
|
||||||
format_string_contains_key(self.dirname_pattern, 'target'))):
|
format_string_contains_key(self.dirname_pattern, 'target'))):
|
||||||
filename = '{0}/{1}_UTC_profile_pic.{2}'.format(self.dirname_pattern.format(profile=profile.username.lower(),
|
filename = '{0}/{1}_UTC_profile_pic.{2}'.format(self.dirname_pattern.format(profile=profile.username.lower(),
|
||||||
target=profile.username.lower()),
|
target=profile.username.lower()),
|
||||||
_epoch_to_string(date_object), profile_pic_url[-3:])
|
_epoch_to_string(date_object), profile_pic_extension)
|
||||||
else:
|
else:
|
||||||
filename = '{0}/{1}_{2}_UTC_profile_pic.{3}'.format(self.dirname_pattern.format(), profile.username.lower(),
|
filename = '{0}/{1}_{2}_UTC_profile_pic.{3}'.format(self.dirname_pattern.format(), profile.username.lower(),
|
||||||
_epoch_to_string(date_object), profile_pic_url[-3:])
|
_epoch_to_string(date_object), profile_pic_extension)
|
||||||
if os.path.isfile(filename):
|
if os.path.isfile(filename):
|
||||||
self.context.log(filename + ' already exists')
|
self.context.log(filename + ' already exists')
|
||||||
return None
|
return None
|
||||||
@@ -395,37 +396,45 @@ class Instaloader:
|
|||||||
:param userids: List of user IDs to be processed in terms of downloading their stories, or None.
|
:param userids: List of user IDs to be processed in terms of downloading their stories, or None.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if userids is None:
|
if not userids:
|
||||||
data = self.context.graphql_query("d15efd8c0c5b23f0ef71f18bf363c704",
|
data = self.context.graphql_query("d15efd8c0c5b23f0ef71f18bf363c704",
|
||||||
{"only_stories": True})["data"]["user"]
|
{"only_stories": True})["data"]["user"]
|
||||||
if data is None:
|
if data is None:
|
||||||
raise BadResponseException('Bad stories reel JSON.')
|
raise BadResponseException('Bad stories reel JSON.')
|
||||||
userids = list(edge["node"]["id"] for edge in data["feed_reels_tray"]["edge_reels_tray_to_reel"]["edges"])
|
userids = list(edge["node"]["id"] for edge in data["feed_reels_tray"]["edge_reels_tray_to_reel"]["edges"])
|
||||||
|
|
||||||
stories = self.context.graphql_query("bf41e22b1c4ba4c9f31b844ebb7d9056",
|
def _userid_chunks():
|
||||||
{"reel_ids": userids, "precomposed_overlay": False})["data"]
|
userids_per_query = 100
|
||||||
|
for i in range(0, len(userids), userids_per_query):
|
||||||
|
yield userids[i:i + userids_per_query]
|
||||||
|
|
||||||
yield from (Story(self.context, media) for media in stories['reels_media'])
|
for userid_chunk in _userid_chunks():
|
||||||
|
stories = self.context.graphql_query("bf41e22b1c4ba4c9f31b844ebb7d9056",
|
||||||
|
{"reel_ids": userid_chunk, "precomposed_overlay": False})["data"]
|
||||||
|
yield from (Story(self.context, media) for media in stories['reels_media'])
|
||||||
|
|
||||||
@_requires_login
|
@_requires_login
|
||||||
def download_stories(self,
|
def download_stories(self,
|
||||||
userids: Optional[List[int]] = None,
|
userids: Optional[List[Union[int, Profile]]] = None,
|
||||||
fast_update: bool = False,
|
fast_update: bool = False,
|
||||||
filename_target: str = ':stories',
|
filename_target: Optional[str] = ':stories',
|
||||||
storyitem_filter: Optional[Callable[[StoryItem], bool]] = None) -> None:
|
storyitem_filter: Optional[Callable[[StoryItem], bool]] = None) -> None:
|
||||||
"""
|
"""
|
||||||
Download available stories from user followees or all stories of users whose ID are given.
|
Download available stories from user followees or all stories of users whose ID are given.
|
||||||
Does not mark stories as seen.
|
Does not mark stories as seen.
|
||||||
To use this, one needs to be logged in
|
To use this, one needs to be logged in
|
||||||
|
|
||||||
:param userids: List of user IDs to be processed in terms of downloading their stories
|
:param userids: List of user IDs or Profiles to be processed in terms of downloading their stories
|
||||||
:param fast_update: If true, abort when first already-downloaded picture is encountered
|
:param fast_update: If true, abort when first already-downloaded picture is encountered
|
||||||
:param filename_target: Replacement for {target} in dirname_pattern and filename_pattern
|
:param filename_target: Replacement for {target} in dirname_pattern and filename_pattern
|
||||||
|
or None if profile name should be used instead
|
||||||
:param storyitem_filter: function(storyitem), which returns True if given StoryItem should be downloaded
|
:param storyitem_filter: function(storyitem), which returns True if given StoryItem should be downloaded
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if not userids:
|
if not userids:
|
||||||
self.context.log("Retrieving all visible stories...")
|
self.context.log("Retrieving all visible stories...")
|
||||||
|
else:
|
||||||
|
userids = [p if isinstance(p, int) else p.userid for p in userids]
|
||||||
|
|
||||||
for user_story in self.get_stories(userids):
|
for user_story in self.get_stories(userids):
|
||||||
name = user_story.owner_username
|
name = user_story.owner_username
|
||||||
@@ -439,7 +448,7 @@ class Instaloader:
|
|||||||
self.context.log("[%3i/%3i] " % (count, totalcount), end="", flush=True)
|
self.context.log("[%3i/%3i] " % (count, totalcount), end="", flush=True)
|
||||||
count += 1
|
count += 1
|
||||||
with self.context.error_catcher('Download story from user {}'.format(name)):
|
with self.context.error_catcher('Download story from user {}'.format(name)):
|
||||||
downloaded = self.download_storyitem(item, filename_target)
|
downloaded = self.download_storyitem(item, filename_target if filename_target else name)
|
||||||
if fast_update and not downloaded:
|
if fast_update and not downloaded:
|
||||||
break
|
break
|
||||||
|
|
||||||
@@ -610,6 +619,24 @@ class Instaloader:
|
|||||||
if fast_update and not downloaded:
|
if fast_update and not downloaded:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
def _get_id_filename(self, profile_name: str) -> str:
|
||||||
|
if ((format_string_contains_key(self.dirname_pattern, 'profile') or
|
||||||
|
format_string_contains_key(self.dirname_pattern, 'target'))):
|
||||||
|
return '{0}/id'.format(self.dirname_pattern.format(profile=profile_name.lower(),
|
||||||
|
target=profile_name.lower()))
|
||||||
|
else:
|
||||||
|
return '{0}/{1}_id'.format(self.dirname_pattern.format(), profile_name.lower())
|
||||||
|
|
||||||
|
def save_profile_id(self, profile: Profile):
|
||||||
|
"""
|
||||||
|
Store ID of profile locally.
|
||||||
|
"""
|
||||||
|
os.makedirs(self.dirname_pattern.format(profile=profile.username,
|
||||||
|
target=profile.username), exist_ok=True)
|
||||||
|
with open(self._get_id_filename(profile.username), 'w') as text_file:
|
||||||
|
text_file.write(str(profile.userid) + "\n")
|
||||||
|
self.context.log("Stored ID {0} for profile {1}.".format(profile.userid, profile.username))
|
||||||
|
|
||||||
def check_profile_id(self, profile_name: str) -> Profile:
|
def check_profile_id(self, profile_name: str) -> Profile:
|
||||||
"""
|
"""
|
||||||
Consult locally stored ID of profile with given name, check whether ID matches and whether name
|
Consult locally stored ID of profile with given name, check whether ID matches and whether name
|
||||||
@@ -622,12 +649,7 @@ class Instaloader:
|
|||||||
with suppress(ProfileNotExistsException):
|
with suppress(ProfileNotExistsException):
|
||||||
profile = Profile.from_username(self.context, profile_name)
|
profile = Profile.from_username(self.context, profile_name)
|
||||||
profile_exists = profile is not None
|
profile_exists = profile is not None
|
||||||
if ((format_string_contains_key(self.dirname_pattern, 'profile') or
|
id_filename = self._get_id_filename(profile_name)
|
||||||
format_string_contains_key(self.dirname_pattern, 'target'))):
|
|
||||||
id_filename = '{0}/id'.format(self.dirname_pattern.format(profile=profile_name.lower(),
|
|
||||||
target=profile_name.lower()))
|
|
||||||
else:
|
|
||||||
id_filename = '{0}/{1}_id'.format(self.dirname_pattern.format(), profile_name.lower())
|
|
||||||
try:
|
try:
|
||||||
with open(id_filename, 'rb') as id_file:
|
with open(id_filename, 'rb') as id_file:
|
||||||
profile_id = int(id_file.read())
|
profile_id = int(id_file.read())
|
||||||
@@ -656,15 +678,11 @@ class Instaloader:
|
|||||||
except (FileNotFoundError, ValueError):
|
except (FileNotFoundError, ValueError):
|
||||||
pass
|
pass
|
||||||
if profile_exists:
|
if profile_exists:
|
||||||
os.makedirs(self.dirname_pattern.format(profile=profile_name.lower(),
|
self.save_profile_id(profile)
|
||||||
target=profile_name.lower()), exist_ok=True)
|
|
||||||
with open(id_filename, 'w') as text_file:
|
|
||||||
text_file.write(str(profile.userid) + "\n")
|
|
||||||
self.context.log("Stored ID {0} for profile {1}.".format(profile.userid, profile_name))
|
|
||||||
return profile
|
return profile
|
||||||
raise ProfileNotExistsException("Profile {0} does not exist.".format(profile_name))
|
raise ProfileNotExistsException("Profile {0} does not exist.".format(profile_name))
|
||||||
|
|
||||||
def download_profile(self, profile_name: str,
|
def download_profile(self, profile_name: Union[str, Profile],
|
||||||
profile_pic: bool = True, profile_pic_only: bool = False,
|
profile_pic: bool = True, profile_pic_only: bool = False,
|
||||||
fast_update: bool = False,
|
fast_update: bool = False,
|
||||||
download_stories: bool = False, download_stories_only: bool = False,
|
download_stories: bool = False, download_stories_only: bool = False,
|
||||||
@@ -675,7 +693,10 @@ class Instaloader:
|
|||||||
# Get profile main page json
|
# Get profile main page json
|
||||||
# check if profile does exist or name has changed since last download
|
# check if profile does exist or name has changed since last download
|
||||||
# and update name and json data if necessary
|
# and update name and json data if necessary
|
||||||
profile = self.check_profile_id(profile_name.lower())
|
if isinstance(profile_name, str):
|
||||||
|
profile = self.check_profile_id(profile_name.lower())
|
||||||
|
else:
|
||||||
|
profile = profile_name
|
||||||
|
|
||||||
profile_name = profile.username
|
profile_name = profile.username
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import textwrap
|
|||||||
import time
|
import time
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
|
from datetime import datetime, timedelta
|
||||||
from typing import Any, Callable, Dict, Iterator, Optional
|
from typing import Any, Callable, Dict, Iterator, Optional
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
@@ -175,6 +176,9 @@ class InstaloaderContext:
|
|||||||
:raises InvalidArgumentException: If the provided username does not exist.
|
:raises InvalidArgumentException: If the provided username does not exist.
|
||||||
:raises BadCredentialsException: If the provided password is wrong.
|
:raises BadCredentialsException: If the provided password is wrong.
|
||||||
:raises ConnectionException: If connection to Instagram failed."""
|
:raises ConnectionException: If connection to Instagram failed."""
|
||||||
|
import http.client
|
||||||
|
# pylint:disable=protected-access
|
||||||
|
http.client._MAXHEADERS = 200
|
||||||
session = requests.Session()
|
session = requests.Session()
|
||||||
session.cookies.update({'sessionid': '', 'mid': '', 'ig_pr': '1',
|
session.cookies.update({'sessionid': '', 'mid': '', 'ig_pr': '1',
|
||||||
'ig_vw': '1920', 'csrftoken': '',
|
'ig_vw': '1920', 'csrftoken': '',
|
||||||
@@ -243,7 +247,8 @@ class InstaloaderContext:
|
|||||||
if is_graphql_query and not query_not_limited:
|
if is_graphql_query and not query_not_limited:
|
||||||
waittime = graphql_query_waittime()
|
waittime = graphql_query_waittime()
|
||||||
if waittime > 0:
|
if waittime > 0:
|
||||||
self.log('\nToo many queries in the last time. Need to wait {} seconds.'.format(waittime))
|
self.log('\nToo many queries in the last time. Need to wait {} seconds, until {:%H:%M}.'
|
||||||
|
.format(waittime, datetime.now() + timedelta(seconds=waittime)))
|
||||||
time.sleep(waittime)
|
time.sleep(waittime)
|
||||||
if self.query_timestamps is not None:
|
if self.query_timestamps is not None:
|
||||||
self.query_timestamps.append(time.monotonic())
|
self.query_timestamps.append(time.monotonic())
|
||||||
@@ -298,7 +303,8 @@ class InstaloaderContext:
|
|||||||
if is_graphql_query:
|
if is_graphql_query:
|
||||||
waittime = graphql_query_waittime(untracked_queries=True)
|
waittime = graphql_query_waittime(untracked_queries=True)
|
||||||
if waittime > 0:
|
if waittime > 0:
|
||||||
self.log('The request will be retried in {} seconds.'.format(waittime))
|
self.log('The request will be retried in {} seconds, at {:%H:%M}.'
|
||||||
|
.format(waittime, datetime.now() + timedelta(seconds=waittime)))
|
||||||
time.sleep(waittime)
|
time.sleep(waittime)
|
||||||
self._sleep()
|
self._sleep()
|
||||||
return self.get_json(path=path, params=params, host=host, session=sess, _attempt=_attempt + 1)
|
return self.get_json(path=path, params=params, host=host, session=sess, _attempt=_attempt + 1)
|
||||||
|
|||||||
@@ -93,10 +93,9 @@ class Post:
|
|||||||
return b64encode(mediaid.to_bytes(9, 'big'), b'-_').decode().replace('A', ' ').lstrip().replace(' ', 'A')
|
return b64encode(mediaid.to_bytes(9, 'big'), b'-_').decode().replace('A', ' ').lstrip().replace(' ', 'A')
|
||||||
|
|
||||||
def _asdict(self):
|
def _asdict(self):
|
||||||
|
node = self._node
|
||||||
if self._full_metadata_dict:
|
if self._full_metadata_dict:
|
||||||
node = self._full_metadata_dict
|
node.update(self._full_metadata_dict)
|
||||||
else:
|
|
||||||
node = self._node
|
|
||||||
if self._owner_profile:
|
if self._owner_profile:
|
||||||
node['owner'] = self.owner_profile._asdict()
|
node['owner'] = self.owner_profile._asdict()
|
||||||
if self._location:
|
if self._location:
|
||||||
@@ -527,10 +526,12 @@ class Profile:
|
|||||||
@property
|
@property
|
||||||
def has_highlight_reels(self) -> bool:
|
def has_highlight_reels(self) -> bool:
|
||||||
"""
|
"""
|
||||||
This becomes `True` if the :class:`Profile` has any stories currently available,
|
.. deprecated:: 4.0.6
|
||||||
even if not viewable by the viewer.
|
Always returns `True` since :issue:`153`.
|
||||||
|
|
||||||
|
Before broken, this indicated whether the :class:`Profile` had available stories.
|
||||||
"""
|
"""
|
||||||
return self._iphone_struct['has_highlight_reels']
|
return True
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def has_public_story(self) -> bool:
|
def has_public_story(self) -> bool:
|
||||||
@@ -610,6 +611,16 @@ class Profile:
|
|||||||
self._rhx_gis,
|
self._rhx_gis,
|
||||||
self._metadata('edge_saved_media')))
|
self._metadata('edge_saved_media')))
|
||||||
|
|
||||||
|
def get_tagged_posts(self) -> Iterator[Post]:
|
||||||
|
"""Retrieve all posts where a profile is tagged."""
|
||||||
|
self._obtain_metadata()
|
||||||
|
yield from (Post(self._context, node, self if int(node['owner']['id']) == self.userid else None) for node in
|
||||||
|
self._context.graphql_node_list("e31a871f7301132ceaab56507a66bbb7",
|
||||||
|
{'id': self.userid},
|
||||||
|
'https://www.instagram.com/{0}/'.format(self.username),
|
||||||
|
lambda d: d['data']['user']['edge_user_to_photos_of_you'],
|
||||||
|
self._rhx_gis))
|
||||||
|
|
||||||
def get_followers(self) -> Iterator['Profile']:
|
def get_followers(self) -> Iterator['Profile']:
|
||||||
"""
|
"""
|
||||||
Retrieve list of followers of given profile.
|
Retrieve list of followers of given profile.
|
||||||
|
|||||||
@@ -40,16 +40,21 @@ class TestInstaloaderAnonymously(unittest.TestCase):
|
|||||||
print("Removing {}".format(self.dir))
|
print("Removing {}".format(self.dir))
|
||||||
shutil.rmtree(self.dir)
|
shutil.rmtree(self.dir)
|
||||||
|
|
||||||
|
def post_paging_test(self, iterator):
|
||||||
|
previous_post = None
|
||||||
|
for post in islice(iterator, PAGING_MAX_COUNT):
|
||||||
|
print(post)
|
||||||
|
if previous_post:
|
||||||
|
self.assertTrue(post.date_utc < previous_post.date_utc)
|
||||||
|
previous_post = post
|
||||||
|
|
||||||
@unittest.SkipTest
|
@unittest.SkipTest
|
||||||
def test_public_profile_download(self):
|
def test_public_profile_download(self):
|
||||||
self.L.download_profile(PUBLIC_PROFILE, profile_pic=False, fast_update=True)
|
self.L.download_profile(PUBLIC_PROFILE, profile_pic=False, fast_update=True)
|
||||||
self.L.download_profile(PUBLIC_PROFILE, profile_pic=False, fast_update=True)
|
self.L.download_profile(PUBLIC_PROFILE, profile_pic=False, fast_update=True)
|
||||||
|
|
||||||
def test_public_profile_paging(self):
|
def test_public_profile_paging(self):
|
||||||
for count, post in enumerate(instaloader.Profile.from_username(self.L.context, PUBLIC_PROFILE).get_posts()):
|
self.post_paging_test(instaloader.Profile.from_username(self.L.context, PUBLIC_PROFILE).get_posts())
|
||||||
print(post)
|
|
||||||
if count == PAGING_MAX_COUNT:
|
|
||||||
break
|
|
||||||
|
|
||||||
def test_profile_pic_download(self):
|
def test_profile_pic_download(self):
|
||||||
self.L.download_profile(PUBLIC_PROFILE, profile_pic_only=True)
|
self.L.download_profile(PUBLIC_PROFILE, profile_pic_only=True)
|
||||||
@@ -71,6 +76,11 @@ class TestInstaloaderAnonymously(unittest.TestCase):
|
|||||||
self.assertEqual(post, post2)
|
self.assertEqual(post, post2)
|
||||||
break
|
break
|
||||||
|
|
||||||
|
def test_public_profile_tagged_paging(self):
|
||||||
|
for post in islice(instaloader.Profile.from_username(self.L.context, PUBLIC_PROFILE).get_tagged_posts(),
|
||||||
|
PAGING_MAX_COUNT):
|
||||||
|
print(post)
|
||||||
|
|
||||||
|
|
||||||
class TestInstaloaderLoggedIn(TestInstaloaderAnonymously):
|
class TestInstaloaderLoggedIn(TestInstaloaderAnonymously):
|
||||||
|
|
||||||
@@ -93,10 +103,7 @@ class TestInstaloaderLoggedIn(TestInstaloaderAnonymously):
|
|||||||
print(item)
|
print(item)
|
||||||
|
|
||||||
def test_private_profile_paging(self):
|
def test_private_profile_paging(self):
|
||||||
for count, post in enumerate(instaloader.Profile.from_username(self.L.context, PRIVATE_PROFILE).get_posts()):
|
self.post_paging_test(instaloader.Profile.from_username(self.L.context, PRIVATE_PROFILE).get_posts())
|
||||||
print(post)
|
|
||||||
if count == PAGING_MAX_COUNT:
|
|
||||||
break
|
|
||||||
|
|
||||||
def test_feed_download(self):
|
def test_feed_download(self):
|
||||||
self.L.download_feed_posts(NORMAL_MAX_COUNT)
|
self.L.download_feed_posts(NORMAL_MAX_COUNT)
|
||||||
|
|||||||
Reference in New Issue
Block a user