mirror of
https://github.com/bellingcat/auto-archiver.git
synced 2026-06-12 21:28:29 +03:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7de317d1b5 | ||
|
|
70075a1e5e |
@@ -102,10 +102,18 @@ class InstagramAPIArchiver(Archiver):
|
|||||||
logger.error(f"Error downloading stories for {username}: {e}")
|
logger.error(f"Error downloading stories for {username}: {e}")
|
||||||
|
|
||||||
# download all posts
|
# download all posts
|
||||||
self.download_all_posts(result, user_id)
|
try:
|
||||||
|
self.download_all_posts(result, user_id)
|
||||||
|
except Exception as e:
|
||||||
|
result.append("errors", f"Error downloading posts for {username}")
|
||||||
|
logger.error(f"Error downloading posts for {username}: {e}")
|
||||||
|
|
||||||
# download all tagged
|
# download all tagged
|
||||||
self.download_all_tagged(result, user_id)
|
try:
|
||||||
|
self.download_all_tagged(result, user_id)
|
||||||
|
except Exception as e:
|
||||||
|
result.append("errors", f"Error downloading tagged posts for {username}")
|
||||||
|
logger.error(f"Error downloading tagged posts for {username}: {e}")
|
||||||
|
|
||||||
# download all highlights
|
# download all highlights
|
||||||
try:
|
try:
|
||||||
@@ -192,7 +200,7 @@ class InstagramAPIArchiver(Archiver):
|
|||||||
post_count = 0
|
post_count = 0
|
||||||
while end_cursor != "":
|
while end_cursor != "":
|
||||||
posts = self.call_api(f"v1/user/medias/chunk", {"user_id": user_id, "end_cursor": end_cursor})
|
posts = self.call_api(f"v1/user/medias/chunk", {"user_id": user_id, "end_cursor": end_cursor})
|
||||||
if not len(posts): break
|
if not len(posts) or not type(posts) == list or len(posts) != 2: break
|
||||||
posts, end_cursor = posts[0], posts[1]
|
posts, end_cursor = posts[0], posts[1]
|
||||||
logger.info(f"parsing {len(posts)} posts, next {end_cursor=}")
|
logger.info(f"parsing {len(posts)} posts, next {end_cursor=}")
|
||||||
|
|
||||||
@@ -243,8 +251,8 @@ class InstagramAPIArchiver(Archiver):
|
|||||||
if self.minimize_json_output:
|
if self.minimize_json_output:
|
||||||
del item["clips_metadata"]
|
del item["clips_metadata"]
|
||||||
|
|
||||||
if code := item.get("code"):
|
if code := item.get("code") and not result.get("url"):
|
||||||
result.set("url", f"https://www.instagram.com/p/{code}/")
|
result.set_url(f"https://www.instagram.com/p/{code}/")
|
||||||
|
|
||||||
resources = item.get("resources", item.get("carousel_media", []))
|
resources = item.get("resources", item.get("carousel_media", []))
|
||||||
item, media, media_id = self.scrape_media(item, context)
|
item, media, media_id = self.scrape_media(item, context)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ _MAJOR = "0"
|
|||||||
_MINOR = "9"
|
_MINOR = "9"
|
||||||
# On main and in a nightly release the patch should be one ahead of the last
|
# On main and in a nightly release the patch should be one ahead of the last
|
||||||
# released build.
|
# released build.
|
||||||
_PATCH = "8"
|
_PATCH = "10"
|
||||||
# This is mainly for nightly builds which have the suffix ".dev$DATE". See
|
# This is mainly for nightly builds which have the suffix ".dev$DATE". See
|
||||||
# https://semver.org/#is-v123-a-semantic-version for the semantics.
|
# https://semver.org/#is-v123-a-semantic-version for the semantics.
|
||||||
_SUFFIX = ""
|
_SUFFIX = ""
|
||||||
|
|||||||
Reference in New Issue
Block a user