Skip to content

Commit

Permalink
[instagram] extract 'coauthors' metadata (#3107)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Oct 26, 2022
1 parent 7c6af27 commit f168ec9
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions gallery_dl/extractor/instagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,15 @@ def _parse_post_rest(self, post):
data["location_url"] = "{}/explore/locations/{}/{}/".format(
self.root, location["pk"], slug)

coauthors = post.get("coauthor_producers")
if coauthors:
data["coauthors"] = [
{"id" : user["pk"],
"username" : user["username"],
"full_name": user["full_name"]}
for user in coauthors
]

if "carousel_media" in post:
items = post["carousel_media"]
data["sidecar_media_id"] = data["post_id"]
Expand Down Expand Up @@ -266,6 +275,14 @@ def _parse_post_graphql(self, post):
data["location_url"] = "{}/explore/locations/{}/{}/".format(
self.root, location["id"], location["slug"])

coauthors = post.get("coauthor_producers")
if coauthors:
data["coauthors"] = [
{"id" : user["id"],
"username": user["username"]}
for user in coauthors
]

data["_files"] = files = []
if "edge_sidecar_to_children" in post:
for num, edge in enumerate(
Expand Down

0 comments on commit f168ec9

Please sign in to comment.