Updated README + {date} default format added

This commit is contained in:
André Koch-Kramer 2017-07-26 19:13:56 +02:00
parent 151ccfd71d
commit c299e9d1a2
2 changed files with 21 additions and 11 deletions

View File

@ -75,6 +75,15 @@ You may also download
instaloader "#hashtag" instaloader "#hashtag"
This downloads the requested posts into a directory named according to the specified
hashtag and the filenames correspond to the timestamp of the posts.
As with all download tasks, this behavior can easily be customized, for example
encode the poster's profile name in the filenames:
::
instaloader --filename-pattern={date}_{profile} "#hashtag"
If you want to **download all followees of a given profile**, call If you want to **download all followees of a given profile**, call
:: ::
@ -158,18 +167,18 @@ How to Download
^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^
--dirname-pattern DIRNAME_PATTERN --dirname-pattern DIRNAME_PATTERN
Name of directory where to store posts. {profile} Name of directory where to store posts. ``{profile}``
is replaced by the profile name, {target} is replaced is replaced by the profile name, ``{target}`` is replaced
by the target you specified, i.e. either :feed, by the target you specified, i.e. either ``:feed``,
#hashtag or the profile name. Defaults to '{target}'. ``#hashtag`` or the profile name. Defaults to ``{target}``.
--filename-pattern FILENAME_PATTERN --filename-pattern FILENAME_PATTERN
Prefix of filenames. Posts are stored in the Prefix of filenames. Posts are stored in the
directory whose pattern is given with --dirname-pattern. directory whose pattern is given with ``--dirname-pattern``.
{profile} is replaced by the profile name, ``{profile}`` is replaced by the profile name,
{target} is replaced by the target you specified, i.e. ``{target}`` is replaced by the target you specified, i.e.
either :feed, #hashtag or the profile name. Also, the either ``:feed``, ``#hashtag`` or the profile name. Also, the
fields date and shortcode can be specified. Defaults fields ``{date}`` and ``{shortcode}`` can be specified.
to '{date:%Y-%m-%d_%H-%M-%S}'. Defaults to ``{date:%Y-%m-%d_%H-%M-%S}``.
--user-agent USER_AGENT User Agent to use for HTTP requests. Per default, --user-agent USER_AGENT User Agent to use for HTTP requests. Per default,
Instaloader pretends being Chrome/51. Instaloader pretends being Chrome/51.
--no-sleep Do not sleep between requests to Instagram's servers. --no-sleep Do not sleep between requests to Instagram's servers.

View File

@ -142,7 +142,8 @@ class Instaloader:
self.quiet = quiet self.quiet = quiet
self.shorter_output = shorter_output self.shorter_output = shorter_output
self.dirname_pattern = dirname_pattern if dirname_pattern is not None else '{target}' self.dirname_pattern = dirname_pattern if dirname_pattern is not None else '{target}'
self.filename_pattern = filename_pattern if filename_pattern is not None else '{date:%Y-%m-%d_%H-%M-%S}' self.filename_pattern = filename_pattern.replace('{date}', '{date:%Y-%m-%d_%H-%M-%S}') \
if filename_pattern is not None else '{date:%Y-%m-%d_%H-%M-%S}'
def _log(self, *msg, sep='', end='\n', flush=False): def _log(self, *msg, sep='', end='\n', flush=False):
if not self.quiet: if not self.quiet: