Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add coauthors to Post #100

Merged
merged 1 commit into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion ensta/Guest.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,16 @@ def __process_post_data(data: dict, reel: bool = False) -> Post:
latest_reel_media=user_data.get("latest_reel_media", 0)
)

coauthors = []
for coauthor in data.get("coauthor_producers", []):
coauthors.append(
{
"uid": coauthor.get("pk", ""),
"username": coauthor.get("username", ""),
"full_name": coauthor.get("full_name", ""),
}
)

return Post(
share_url=f"https://www.instagram.com/reel/{data.get('code', '')}"
if reel
Expand Down Expand Up @@ -482,5 +492,6 @@ def __process_post_data(data: dict, reel: bool = False) -> Post:
explore_hide_comments=data.get("explore_hide_comments", False),
has_delayed_metadata=data.get("has_delayed_metadata", False),
location_latitude=data.get("lat", 0),
location_longitude=data.get("lng", 0)
location_longitude=data.get("lng", 0),
coauthors=coauthors,
)
1 change: 1 addition & 0 deletions ensta/containers/Post.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ class Post:
has_delayed_metadata: bool = False
location_latitude: float = 0
location_longitude: float = 0
coauthors: list[dict] = field(default_factory=list)
Loading