instagram-archiver 0.3.1__tar.gz → 0.3.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of instagram-archiver might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: instagram-archiver
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Summary: Save Instagram content you have access to.
5
5
  License: MIT
6
6
  Keywords: command line,instagram
@@ -33,7 +33,7 @@ Description-Content-Type: text/markdown
33
33
  [![PyPI - Version](https://img.shields.io/pypi/v/instagram-archiver)](https://pypi.org/project/instagram-archiver/)
34
34
  [![GitHub tag (with filter)](https://img.shields.io/github/v/tag/Tatsh/instagram-archiver)](https://github.com/Tatsh/instagram-archiver/tags)
35
35
  [![License](https://img.shields.io/github/license/Tatsh/instagram-archiver)](https://github.com/Tatsh/instagram-archiver/blob/master/LICENSE.txt)
36
- [![GitHub commits since latest release (by SemVer including pre-releases)](https://img.shields.io/github/commits-since/Tatsh/instagram-archiver/v0.3.1/master)](https://github.com/Tatsh/instagram-archiver/compare/v0.3.1...master)
36
+ [![GitHub commits since latest release (by SemVer including pre-releases)](https://img.shields.io/github/commits-since/Tatsh/instagram-archiver/v0.3.2/master)](https://github.com/Tatsh/instagram-archiver/compare/v0.3.2...master)
37
37
  [![QA](https://github.com/Tatsh/instagram-archiver/actions/workflows/qa.yml/badge.svg)](https://github.com/Tatsh/instagram-archiver/actions/workflows/qa.yml)
38
38
  [![Tests](https://github.com/Tatsh/instagram-archiver/actions/workflows/tests.yml/badge.svg)](https://github.com/Tatsh/instagram-archiver/actions/workflows/tests.yml)
39
39
  [![Coverage Status](https://coveralls.io/repos/github/Tatsh/instagram-archiver/badge.svg?branch=master)](https://coveralls.io/github/Tatsh/instagram-archiver?branch=master)
@@ -4,7 +4,7 @@
4
4
  [![PyPI - Version](https://img.shields.io/pypi/v/instagram-archiver)](https://pypi.org/project/instagram-archiver/)
5
5
  [![GitHub tag (with filter)](https://img.shields.io/github/v/tag/Tatsh/instagram-archiver)](https://github.com/Tatsh/instagram-archiver/tags)
6
6
  [![License](https://img.shields.io/github/license/Tatsh/instagram-archiver)](https://github.com/Tatsh/instagram-archiver/blob/master/LICENSE.txt)
7
- [![GitHub commits since latest release (by SemVer including pre-releases)](https://img.shields.io/github/commits-since/Tatsh/instagram-archiver/v0.3.1/master)](https://github.com/Tatsh/instagram-archiver/compare/v0.3.1...master)
7
+ [![GitHub commits since latest release (by SemVer including pre-releases)](https://img.shields.io/github/commits-since/Tatsh/instagram-archiver/v0.3.2/master)](https://github.com/Tatsh/instagram-archiver/compare/v0.3.2...master)
8
8
  [![QA](https://github.com/Tatsh/instagram-archiver/actions/workflows/qa.yml/badge.svg)](https://github.com/Tatsh/instagram-archiver/actions/workflows/qa.yml)
9
9
  [![Tests](https://github.com/Tatsh/instagram-archiver/actions/workflows/tests.yml/badge.svg)](https://github.com/Tatsh/instagram-archiver/actions/workflows/tests.yml)
10
10
  [![Coverage Status](https://coveralls.io/repos/github/Tatsh/instagram-archiver/badge.svg?branch=master)](https://coveralls.io/github/Tatsh/instagram-archiver?branch=master)
@@ -6,4 +6,4 @@ from .profile_scraper import ProfileScraper
6
6
  from .saved_scraper import SavedScraper
7
7
 
8
8
  __all__ = ('InstagramClient', 'ProfileScraper', 'SavedScraper')
9
- __version__ = 'v0.3.1'
9
+ __version__ = 'v0.3.2'
@@ -116,22 +116,26 @@ class ProfileScraper(SaveCommentsCheckDisabledMixin, InstagramClient):
116
116
  r = self.get_json('https://i.instagram.com/api/v1/users/web_profile_info/',
117
117
  params={'username': self._username},
118
118
  cast_to=WebProfileInfo)
119
- with Path('web_profile_info.json').open('w', encoding='utf-8') as f:
120
- json.dump(r, f, indent=2, sort_keys=True)
121
- user_info = r['data']['user']
122
- if not self.is_saved(user_info['profile_pic_url_hd']):
123
- with Path('profile_pic.jpg').open('wb') as f:
124
- f.writelines(
125
- self.session.get(user_info['profile_pic_url_hd'],
126
- stream=True).iter_content(chunk_size=512))
127
- self.save_to_log(user_info['profile_pic_url_hd'])
128
- try:
129
- for item in self.highlights_tray(user_info['id'])['tray']:
130
- self.add_video_url('https://www.instagram.com/stories/highlights/'
131
- f'{item["id"].split(":")[-1]}/')
132
- except HTTPError:
133
- log.exception('Failed to get highlights data.')
134
- self.save_edges(user_info['edge_owner_to_timeline_media']['edges'])
119
+ if 'data' in r:
120
+ with Path('web_profile_info.json').open('w', encoding='utf-8') as f:
121
+ json.dump(r, f, indent=2, sort_keys=True)
122
+ user_info = r['data']['user']
123
+ if not self.is_saved(user_info['profile_pic_url_hd']):
124
+ with Path('profile_pic.jpg').open('wb') as f:
125
+ f.writelines(
126
+ self.session.get(user_info['profile_pic_url_hd'],
127
+ stream=True).iter_content(chunk_size=512))
128
+ self.save_to_log(user_info['profile_pic_url_hd'])
129
+ try:
130
+ for item in self.highlights_tray(user_info['id'])['tray']:
131
+ self.add_video_url('https://www.instagram.com/stories/highlights/'
132
+ f'{item["id"].split(":")[-1]}/')
133
+ except HTTPError:
134
+ log.exception('Failed to get highlights data.')
135
+ self.save_edges(user_info['edge_owner_to_timeline_media']['edges'])
136
+ else:
137
+ log.warning(
138
+ 'Failed to get user info. Profile information and image will not be saved.')
135
139
  d = self.graphql_query(
136
140
  {
137
141
  'data': {
@@ -180,15 +184,15 @@ class ProfileScraper(SaveCommentsCheckDisabledMixin, InstagramClient):
180
184
  with get_configured_yt_dlp() as ydl:
181
185
  while self.video_urls and (url := self.video_urls.pop()):
182
186
  if self.is_saved(url):
183
- log.info('`%s` is already saved.', url)
187
+ log.info('%s is already saved.', url)
184
188
  continue
185
189
  if ydl.extract_info(url):
186
- log.info('Extracting `%s`.', url)
190
+ log.info('Downloading video: %s', url)
187
191
  self.save_to_log(url)
188
192
  else:
189
193
  self.failed_urls.add(url)
190
194
  if self.failed_urls:
191
- log.warning('Some video URIs failed. Check failed.txt.')
195
+ log.warning('Some URIs failed. Check failed.txt.')
192
196
  with Path('failed.txt').open('w', encoding='utf-8') as f:
193
197
  for url in self.failed_urls:
194
198
  f.write(f'{url}\n')
@@ -163,7 +163,7 @@ class WebProfileInfoData(TypedDict):
163
163
 
164
164
  class WebProfileInfo(TypedDict):
165
165
  """Profile information container."""
166
- data: WebProfileInfoData
166
+ data: NotRequired[WebProfileInfoData]
167
167
  """Profile data."""
168
168
 
169
169
 
@@ -27,9 +27,9 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
27
27
  .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
28
28
  .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
29
29
  ..
30
- .TH "INSTAGRAM-ARCHIVER" "1" "May 12, 2025" "0.3.1" "instagram-archiver"
30
+ .TH "INSTAGRAM-ARCHIVER" "1" "May 12, 2025" "0.3.2" "instagram-archiver"
31
31
  .SH NAME
32
- instagram-archiver \- instagram-archiver v0.3.1
32
+ instagram-archiver \- instagram-archiver v0.3.2
33
33
  .SH COMMANDS
34
34
  .SS instagram\-archiver
35
35
  .sp
@@ -18,7 +18,7 @@ keywords = ["command line", "instagram"]
18
18
  license = "MIT"
19
19
  name = "instagram-archiver"
20
20
  readme = "README.md"
21
- version = "0.3.1"
21
+ version = "0.3.2"
22
22
 
23
23
  [[project.authors]]
24
24
  email = "audvare@gmail.com"