GithubHelp home page GithubHelp logo

Login about instascrape HOT 6 CLOSED

chris-greening avatar chris-greening commented on June 4, 2024
Login

from instascrape.

Comments (6)

tarob0ba avatar tarob0ba commented on June 4, 2024 4

Based on what I've seen in the source, I believe (~95%) that you should pass your Instagram session id to the scrape method as indicated by the exception, but you should confirm with @chris-greening, since I don't have an account to test this.

from instascrape import *

session_id = '' # Your session ID - http://valvepress.com/how-to-get-instagram-session-cookie/

google = Profile('https://www.instagram.com/google/')

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={session_id};"}

google.scrape(headers=headers)

print(google.followers)

from instascrape.

Matteoo98 avatar Matteoo98 commented on June 4, 2024 1

Yes this would avoid problems, but how long does the session last ? I think that would be more efficent if i will implement a login first then get the sessionid and each time control the validity and in case repeat the login. What is your take on this ?

from instascrape.

drctoday avatar drctoday commented on June 4, 2024 1

@beckettnormington nailed it exactly, thank you so much!

@Matteoo98, Instagram has been making it increasingly harder to scrape data from their platform so for the most part, you will have to pass a valid session ID as a cookie (as shown above in Beckett's sample code).

Unfortunately, instascrape itself doesn't provide login capabilities as of right now because it runs the risk of getting an account flagged as suspicious but you can manually find your session ID by following these steps.

Hope this helps!

Hi Chris,

I am pretty sure I am passing the Session Id (from Google Chrome -- Inspect -- Application -- Instagram -- Session Id, and my Instagram account is logged in). However, I still receive a message indicates that I need to pass an active session id as cookie.

"InstagramLoginRedirectError: Instagram is redirecting you to the login page instead of the page you are trying to scrape. This could be occuring because you made too many requests too quickly or are not logged into Instagram on your machine. Try passing a valid session ID to the scrape method as a cookie to bypass the login requirement"

from instascrape.

chris-greening avatar chris-greening commented on June 4, 2024

@beckettnormington nailed it exactly, thank you so much!

@Matteoo98, Instagram has been making it increasingly harder to scrape data from their platform so for the most part, you will have to pass a valid session ID as a cookie (as shown above in Beckett's sample code).

Unfortunately, instascrape itself doesn't provide login capabilities as of right now because it runs the risk of getting an account flagged as suspicious but you can manually find your session ID by following these steps.

Hope this helps!

from instascrape.

logbasex avatar logbasex commented on June 4, 2024

I'm facing the same problem.

from instascrape.

haresh14 avatar haresh14 commented on June 4, 2024

I am facing the same problem

from instascrape.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.