mirror of
https://github.com/instaloader/instaloader.git
synced 2026-11-01 13:05:29 -08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3955540080 | ||
|
|
3fe6b1e139 | ||
|
|
a2ce906fd0 | ||
|
|
227efa7b68 | ||
|
|
d7f7cad4a2 |
@@ -0,0 +1 @@
|
|||||||
|
custom: "https://instaloader.github.io/contributing.html#donations"
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
|
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Please describe:
|
Thanks for your willingness to contribute to Instaloader! Please briefly
|
||||||
|
describe
|
||||||
|
|
||||||
- A motivation for this change, e.g.
|
- A motivation for this change, e.g.
|
||||||
- Fixes # .
|
- Fixes # .
|
||||||
|
|||||||
+1
-1
@@ -65,7 +65,7 @@ extlinks = {
|
|||||||
'Issue #'
|
'Issue #'
|
||||||
),
|
),
|
||||||
'example': (
|
'example': (
|
||||||
'https://raw.githubusercontent.com/instaloader/instaloader/v' + current_release + '/docs/codesnippets/%s',
|
'https://raw.githubusercontent.com/instaloader/instaloader/master/docs/codesnippets/%s',
|
||||||
'Example '
|
'Example '
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-3
@@ -11,11 +11,19 @@ Instaloader's development is organized on
|
|||||||
`GitHub <https://github.com/instaloader/instaloader>`__, where Issues and Pull
|
`GitHub <https://github.com/instaloader/instaloader>`__, where Issues and Pull
|
||||||
Requests are discussed.
|
Requests are discussed.
|
||||||
|
|
||||||
|
Contributing to an open source project is an unmatchable opportunity to improve
|
||||||
|
and manifest programming skills. For issues that are good starting points to get
|
||||||
|
involved in Instaloader development, as they do not require deep insight into
|
||||||
|
Instaloader's code base, have a look at our
|
||||||
|
`Issues labelled 'good first issue' <https://github.com/instaloader/instaloader/contribute>`__.
|
||||||
|
|
||||||
|
This document covers several ways of how you can contribute back to Instaloader.
|
||||||
|
|
||||||
Answering Questions
|
Answering Questions
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
The easiest way to help out is to answer questions. If you are interested in
|
The easiest way to help out is to answer questions. If you are interested in
|
||||||
answering questions regarding Instaloader, good places to start are
|
answering questions regarding Instaloader, good places to begin are
|
||||||
|
|
||||||
- `Questions tagged 'instaloader' on Stack Overflow <https://stackoverflow.com/questions/tagged/instaloader>`__,
|
- `Questions tagged 'instaloader' on Stack Overflow <https://stackoverflow.com/questions/tagged/instaloader>`__,
|
||||||
- `Instaloader Issues labeled 'question' <https://github.com/instaloader/instaloader/issues?q=is%3Aissue+is%3Aopen+label%3Aquestion>`__.
|
- `Instaloader Issues labeled 'question' <https://github.com/instaloader/instaloader/issues?q=is%3Aissue+is%3Aopen+label%3Aquestion>`__.
|
||||||
@@ -81,8 +89,8 @@ Improvements of the Instaloader source or its documentation can be proposed as a
|
|||||||
make -C docs html
|
make -C docs html
|
||||||
|
|
||||||
- Feel free to create an issue to make sure someone from the Instaloader team
|
- Feel free to create an issue to make sure someone from the Instaloader team
|
||||||
agrees that the change might be an improvement, and is happy with your basic
|
agrees that the change might be an improvement, or if you want to discuss
|
||||||
proposal, before working on a pull request.
|
your basic proposal, before working on a pull request.
|
||||||
|
|
||||||
Proposing Features
|
Proposing Features
|
||||||
------------------
|
------------------
|
||||||
|
|||||||
@@ -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.6rc1'
|
__version__ = '4.6'
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -524,11 +524,15 @@ class Instaloader:
|
|||||||
self.context.two_factor_login(two_factor_code)
|
self.context.two_factor_login(two_factor_code)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def __prepare_filename(filename_template: str, url: str) -> str:
|
def __prepare_filename(filename_template: str, url: Callable[[], str]) -> str:
|
||||||
"""Replace filename token inside filename_template with url's filename and assure the directories exist.
|
"""Replace filename token inside filename_template with url's filename and assure the directories exist.
|
||||||
|
|
||||||
.. versionadded:: 4.6"""
|
.. versionadded:: 4.6"""
|
||||||
filename = filename_template.replace("{filename}", os.path.splitext(os.path.basename(urlparse(url).path))[0])
|
if "{filename}" in filename_template:
|
||||||
|
filename = filename_template.replace("{filename}",
|
||||||
|
os.path.splitext(os.path.basename(urlparse(url()).path))[0])
|
||||||
|
else:
|
||||||
|
filename = filename_template
|
||||||
os.makedirs(os.path.dirname(filename), exist_ok=True)
|
os.makedirs(os.path.dirname(filename), exist_ok=True)
|
||||||
return filename
|
return filename
|
||||||
|
|
||||||
@@ -549,7 +553,7 @@ class Instaloader:
|
|||||||
|
|
||||||
dirname = _PostPathFormatter(post).format(self.dirname_pattern, target=target)
|
dirname = _PostPathFormatter(post).format(self.dirname_pattern, target=target)
|
||||||
filename_template = os.path.join(dirname, self.format_filename(post, target=target))
|
filename_template = os.path.join(dirname, self.format_filename(post, target=target))
|
||||||
filename = self.__prepare_filename(filename_template, post.url)
|
filename = self.__prepare_filename(filename_template, lambda: post.url)
|
||||||
|
|
||||||
# Download the image(s) / video thumbnail and videos within sidecars if desired
|
# Download the image(s) / video thumbnail and videos within sidecars if desired
|
||||||
downloaded = True
|
downloaded = True
|
||||||
@@ -563,7 +567,8 @@ class Instaloader:
|
|||||||
suffix = str(edge_number)
|
suffix = str(edge_number)
|
||||||
if '{filename}' in self.filename_pattern:
|
if '{filename}' in self.filename_pattern:
|
||||||
suffix = ''
|
suffix = ''
|
||||||
filename = self.__prepare_filename(filename_template, sidecar_node.display_url)
|
# pylint:disable=cell-var-from-loop
|
||||||
|
filename = self.__prepare_filename(filename_template, lambda: sidecar_node.display_url)
|
||||||
# Download sidecar picture or video thumbnail (--no-pictures implies --no-video-thumbnails)
|
# Download sidecar picture or video thumbnail (--no-pictures implies --no-video-thumbnails)
|
||||||
downloaded &= self.download_pic(filename=filename, url=sidecar_node.display_url,
|
downloaded &= self.download_pic(filename=filename, url=sidecar_node.display_url,
|
||||||
mtime=post.date_local, filename_suffix=suffix)
|
mtime=post.date_local, filename_suffix=suffix)
|
||||||
@@ -571,7 +576,8 @@ class Instaloader:
|
|||||||
suffix = str(edge_number)
|
suffix = str(edge_number)
|
||||||
if '{filename}' in self.filename_pattern:
|
if '{filename}' in self.filename_pattern:
|
||||||
suffix = ''
|
suffix = ''
|
||||||
filename = self.__prepare_filename(filename_template, sidecar_node.video_url)
|
# pylint:disable=cell-var-from-loop
|
||||||
|
filename = self.__prepare_filename(filename_template, lambda: sidecar_node.video_url)
|
||||||
# Download sidecar video if desired
|
# Download sidecar video if desired
|
||||||
downloaded &= self.download_pic(filename=filename, url=sidecar_node.video_url,
|
downloaded &= self.download_pic(filename=filename, url=sidecar_node.video_url,
|
||||||
mtime=post.date_local, filename_suffix=suffix)
|
mtime=post.date_local, filename_suffix=suffix)
|
||||||
@@ -690,13 +696,13 @@ class Instaloader:
|
|||||||
date_local = item.date_local
|
date_local = item.date_local
|
||||||
dirname = _PostPathFormatter(item).format(self.dirname_pattern, target=target)
|
dirname = _PostPathFormatter(item).format(self.dirname_pattern, target=target)
|
||||||
filename_template = os.path.join(dirname, self.format_filename(item, target=target))
|
filename_template = os.path.join(dirname, self.format_filename(item, target=target))
|
||||||
filename = self.__prepare_filename(filename_template, item.url)
|
filename = self.__prepare_filename(filename_template, lambda: item.url)
|
||||||
downloaded = False
|
downloaded = False
|
||||||
if not item.is_video or self.download_video_thumbnails is True:
|
if not item.is_video or self.download_video_thumbnails is True:
|
||||||
url = item.url
|
url = item.url
|
||||||
downloaded = self.download_pic(filename=filename, url=url, mtime=date_local)
|
downloaded = self.download_pic(filename=filename, url=url, mtime=date_local)
|
||||||
if item.is_video and self.download_videos is True:
|
if item.is_video and self.download_videos is True:
|
||||||
filename = self.__prepare_filename(filename_template, str(item.video_url))
|
filename = self.__prepare_filename(filename_template, lambda: str(item.video_url))
|
||||||
downloaded |= self.download_pic(filename=filename, url=item.video_url, mtime=date_local)
|
downloaded |= self.download_pic(filename=filename, url=item.video_url, mtime=date_local)
|
||||||
# Save caption if desired
|
# Save caption if desired
|
||||||
metadata_string = _ArbitraryItemFormatter(item).format(self.storyitem_metadata_txt_pattern).strip()
|
metadata_string = _ArbitraryItemFormatter(item).format(self.storyitem_metadata_txt_pattern).strip()
|
||||||
|
|||||||
Reference in New Issue
Block a user