caption_hashtags property for only-if evaluation

caption_hashtags is a list of all hashtags that are mentioned in the
Post's caption. It allows to easily filter Posts that have multiple
hashtags, and as such fixes #24.

Further, the documentation of --only-if has been completed by linking to
a description of the syntax in the Python documentation, and by linking
to a list of all defined properties with their meanings. So, this commit
also closes #42.
This commit is contained in:
Alexander Graf
2017-08-29 11:03:12 +02:00
parent d84136b2dd
commit 5b5d540310
4 changed files with 29 additions and 2 deletions

View File

@@ -129,8 +129,8 @@ Filter Posts
The ``--only-if`` option allows to specify criterias that posts have to
meet to be downloaded. If not given, all posts are downloaded. It must
be a boolean Python expression where the variables ``likes``,
``comments``, ``viewer_has_liked``, ``is_video``, ``date``, and some
more (see class ``instaloader.Post`` for a full list) are defined.
``comments``, ``viewer_has_liked``, ``is_video``, and many
more are defined.
A few examples:
@@ -153,8 +153,17 @@ Or you may **skip videos**:
instaloader --only-if="not is_video" target
Or you may filter by hashtags that occur in the Post's caption. For
example, to download posts of kittens that are cute: ::
instaloader --only-if="'cute' in caption_hashtags" "#kitten"
.. basic-usage-end
(For a more complete description of the ``-only-if`` option, refer to
the `Instaloader Documentation <https://instaloader.readthedocs.io/basic-usage.html#filter-posts>`__)
Advanced Options
----------------