question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

get_recent_posts() raises MissingCookieWarning but we can't pass a valid cookie

See original GitHub issue

Describe 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:open
  • Created 3 years ago
  • Reactions:2
  • Comments:9

github_iconTop GitHub Comments

2reactions
asauce0972commented, Mar 12, 2021

Any way around it so far without selenium?

1reaction
yeamusic21commented, Mar 30, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found