Skip to content
This repository was archived by the owner on Apr 20, 2023. It is now read-only.

Commit 68bdd4b

Browse files
fix: fixed sessionid profile_pic_url and profile_pic_url_hd
1 parent 1256f7b commit 68bdd4b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

instascrape/core/_static_scraper.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from typing import Union, Dict, List, Any
88
import sys
99
import os
10-
from collections import namedtuple
10+
from collections import namedtuple, deque
1111
import warnings
1212

1313
import requests
@@ -143,6 +143,12 @@ def scrape(
143143
else:
144144
return_data = self._get_json_from_source(self.source, headers=headers, session=session)
145145
flat_json_dict = flatten_dict(return_data["json_dict"])
146+
147+
#HACK: patch mapping to fix the profile pic scrape when a sessionid is present
148+
if "sessionid" in headers["cookie"]:
149+
mapping["profile_pic_url"] = deque(["user_profile_pic_url"])
150+
mapping["profile_pic_url_hd"] = deque(["user_profile_pic_url_hd"])
151+
146152
scraped_dict = parse_data_from_json(
147153
json_dict=flat_json_dict,
148154
map_dict=mapping,

0 commit comments

Comments
 (0)