get_recent_posts() raises MissingCookieWarning but we can't pass a valid cookie
See original GitHub issueDescribe the bug The get_recent_posts() method raises MissingCookieWarning, but we can’t pass a valid cookie header to avoid that
To Reproduce
from instascrape import *
instagram_sessionid = "xxx"
headers = {"user-agent": "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Mobile Safari/537.36 Edg/87.0.664.57",
"cookie": f"sessionid={instagram_sessionid};"}
profile = Profile('https://www.instagram.com/google/')
profile.scrape(headers=headers)
print(profile.posts)
recents = profile.get_recent_posts() #We should pass a cookie here
The code is executed correctly but we get a MissingCookiesWarning: Request header does not contain cookies! It's recommended you pass at least a valid sessionid otherwise Instagram will likely redirect you to their login page.
warning
If I try to pass a header cookie:
from instascrape import *
instagram_sessionid = "xxx"
headers = {"user-agent": "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Mobile Safari/537.36 Edg/87.0.664.57",
"cookie": f"sessionid={instagram_sessionid};"}
profile = Profile('https://www.instagram.com/google/')
profile.scrape(headers=headers)
print(profile.posts)
recents = profile.get_recent_posts(headers=headers) #This time I try to pass an header cookie
I get a TypeError: get_recent_posts() got an unexpected keyword argument 'headers'
Expected behavior We should be able to pass a valid cookie to avoid the warning or the warning should not be triggered altogether.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:9
Top Results From Across the Web
How to bypass and block infuriating cookie popups | WIRED UK
How to bypass and block infuriating cookie popups. Cookie consent popups are everywhere and opting out of tracking is a pain. It doesn't...
Read more >Group: Cookie Consent Management - CookiePro Community
I just implemented OneTrust and decided to go with Autoblocking to avoid having to do a bunch of configuration in Tealium.
Read more >Blocking annoying and privacy-harming cookie consent banners
Enabling and managing cookie banner blocking in Brave. Screenshot of Cookie-Blocking Consent Dialog. On start up, the Brave browser will ask if ...
Read more >Europe's cookie consent reckoning is coming - TechCrunch
Cookie pop-ups getting you down? Complaints that the web is “unusable” in Europe because of frustrating and confusing “data choice” ...
Read more >How do we comply with the cookie rules? - ICO
In any case, doing so will increase levels of user awareness and control, and also assist in gaining valid consent. You also need...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Any way around it so far without selenium?
Just noting that this issue has made it pretty much impossible for me to use instascrape for my use case. Due to this issue and https://github.com/chris-greening/instascrape/issues/89 at this point I’ve abandoned instacrape.