From f09bd51ed416710b47226b3e91faefa14c85e91a Mon Sep 17 00:00:00 2001 From: Alexander Graf <17130992+aandergr@users.noreply.github.com> Date: Sat, 25 Sep 2021 10:32:36 +0200 Subject: [PATCH 1/3] Update feature suggestion issue template --- .github/ISSUE_TEMPLATE/feature_request.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 5c91b1c..b7a1b97 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -6,13 +6,15 @@ labels: "feature suggestion" --- **Provide us a use case of the feature** -How could the user invoke the new function? Which problem would it solve? If new information is obtained, how would it be further processed? +How could the user invoke the new function? Which problem would it solve? +If new information is obtained, how would it be further processed? **Describe the solution you'd like** A clear and concise description of what you want to happen. **Describe alternatives you've considered** A clear and concise description of any alternative solutions or features you've considered. +How do you achieve the here-described goal without the feature you are requesting? **If the feature request is accepted, would you be willing to submit a pull request?** Yes / No @@ -21,4 +23,9 @@ Yes / No **Additional context** Add any other context about the feature request here. - + From 0300d8a4f175c3c25eaa604743af01c977d85c30 Mon Sep 17 00:00:00 2001 From: Alexander Graf <17130992+aandergr@users.noreply.github.com> Date: Fri, 12 Nov 2021 14:14:59 +0100 Subject: [PATCH 2/3] Fix CI for Python 3.10 --- .github/workflows/lint.yml | 2 +- .github/workflows/windows_exe.yml | 4 ++-- deploy/windows/create_exe.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 2938ea0..48e2e01 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.8, 3.9] + python-version: ["3.8", "3.9", "3.10"] steps: - name: Checkout Instaloader Repository uses: actions/checkout@v2 diff --git a/.github/workflows/windows_exe.yml b/.github/workflows/windows_exe.yml index 33028fb..9533022 100644 --- a/.github/workflows/windows_exe.yml +++ b/.github/workflows/windows_exe.yml @@ -10,9 +10,9 @@ jobs: - name: Checkout Instaloader repository uses: actions/checkout@v2 - name: Setup Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v2 with: - python-version: 3.9 + python-version: "3.9" architecture: x64 - name: Get the tagged version id: get_version diff --git a/deploy/windows/create_exe.py b/deploy/windows/create_exe.py index 002ca10..1766582 100644 --- a/deploy/windows/create_exe.py +++ b/deploy/windows/create_exe.py @@ -45,7 +45,7 @@ with open('__main__.py', 'w+') as f: # install dependencies and invoke PyInstaller commands = ["pip install pipenv==2020.11.15", - "pipenv sync --dev", + f"pipenv --python {sys.version_info.major}.{sys.version_info.minor} sync --dev", "pipenv run pyinstaller --log-level=DEBUG instaloader.spec"] for command in commands: From 470fc0d905ae5f51867a4f0fb13ff9c0e8118bdd Mon Sep 17 00:00:00 2001 From: fireattack Date: Fri, 12 Nov 2021 08:21:33 -0600 Subject: [PATCH 3/3] Fix KeyError for video_url, and better workflow (#1321) Fixes #1320. --- instaloader/structures.py | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/instaloader/structures.py b/instaloader/structures.py index 726fe61..f4ac793 100644 --- a/instaloader/structures.py +++ b/instaloader/structures.py @@ -377,20 +377,23 @@ class Post: def video_url(self) -> Optional[str]: """URL of the video, or None.""" if self.is_video: - version_urls = [self._field('video_url')] + version_urls = [] + try: + version_urls.append(self._field('video_url')) + except (InstaloaderException, KeyError, IndexError) as err: + self._context.error(f"Warning: Unable to fetch video from graphql of {self}: {err}") if self._context.iphone_support and self._context.is_logged_in: try: version_urls.extend(version['url'] for version in self._iphone_struct['video_versions']) except (InstaloaderException, KeyError, IndexError) as err: self._context.error(f"Unable to fetch high-quality video version of {self}: {err}") - return version_urls[0] - else: + version_urls = list(dict.fromkeys(version_urls)) + if len(version_urls) == 0: + return None + if len(version_urls) == 1: return version_urls[0] url_candidates: List[Tuple[int, str]] = [] for idx, version_url in enumerate(version_urls): - if any(url_candidate[1] == version_url for url_candidate in url_candidates): - # Skip duplicates - continue try: url_candidates.append(( int(self._context.head(version_url, allow_redirects=True).headers.get('Content-Length', 0)), @@ -1129,20 +1132,23 @@ class StoryItem: def video_url(self) -> Optional[str]: """URL of the video, or None.""" if self.is_video: - version_urls = [self._node['video_resources'][-1]['src']] + version_urls = [] + try: + version_urls.append(self._node['video_resources'][-1]['src']) + except (InstaloaderException, KeyError, IndexError) as err: + self._context.error(f"Warning: Unable to fetch video from graphql of {self}: {err}") if self._context.iphone_support and self._context.is_logged_in: try: version_urls.extend(version['url'] for version in self._iphone_struct['video_versions']) except (InstaloaderException, KeyError, IndexError) as err: self._context.error(f"Unable to fetch high-quality video version of {self}: {err}") - return version_urls[0] - else: + version_urls = list(dict.fromkeys(version_urls)) + if len(version_urls) == 0: + return None + if len(version_urls) == 1: return version_urls[0] url_candidates: List[Tuple[int, str]] = [] for idx, version_url in enumerate(version_urls): - if any(url_candidate[1] == version_url for url_candidate in url_candidates): - # Skip duplicates - continue try: url_candidates.append(( int(self._context.head(version_url, allow_redirects=True).headers.get('Content-Length', 0)),