Skip to content
This repository was archived by the owner on Apr 20, 2023. It is now read-only.
Open
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
5 changes: 4 additions & 1 deletion instascrape/core/_static_scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,14 @@ def scrape(
return_data = self._get_json_from_source(self.source, headers=headers, session=session)
flat_json_dict = flatten_dict(return_data["json_dict"])

#HACK: patch mapping to fix the profile pic scrape when a sessionid is present
# HACK: patch mapping to fix the profile pic and biography scrape when a sessionid is present
# When a sessionid is present we should map to the corresponding "user_***" key
# Example: "biography" should be mapped to "user_biography"
try:
if "sessionid" in headers["cookie"]:
mapping["profile_pic_url"] = deque(["user_profile_pic_url"])
mapping["profile_pic_url_hd"] = deque(["user_profile_pic_url_hd"])
mapping["biography"] = deque(["user_biography"])
except KeyError:
pass

Expand Down