Python Requests login and persistent sessions tutorial 🔥: the "Hacker" way | Python web scraping

Поділитися
Вставка
  • Опубліковано 7 жов 2024

КОМЕНТАРІ • 199

  • @abgezocktpfui1134
    @abgezocktpfui1134 2 роки тому +23

    PERFECT explained! - especially at the minute 7:55 with the doChallengeResponse part with the mechanism to analyze and reconstruct the md5-coded hash.
    Good visibility of the font size and the speed of explanation.

    • @RedEyedCoderClub
      @RedEyedCoderClub  2 роки тому +1

      Thank you for you comment, and have a nice day :)

  • @EnglishRain
    @EnglishRain 4 роки тому +35

    This was absolutely mind-blowing. Awesome job, man, SUPERB video. You're a wizard!

  • @luccarodrigues781
    @luccarodrigues781 3 роки тому +4

    Thank you so much for this video! Helped me a lot with my web scraping adventures. Keep up the great work, man!

    • @RedEyedCoderClub
      @RedEyedCoderClub  3 роки тому

      Thank you! I glad, that my content was useful for you! Good luck!

  • @dmitryk1866
    @dmitryk1866 4 роки тому +6

    Thanks a lot! Very interesting and useful video. I didn't think that it would be so unusual.
    Funny conclusion -- "There is no security at the frontend"

    • @RedEyedCoderClub
      @RedEyedCoderClub  4 роки тому +1

      Glad to help, and thanks for you suggestion - very useful!

  • @RedEyedCoderClub
    @RedEyedCoderClub  3 роки тому +3

    What video should I make next? Any suggestions? *Write me in comments!*
    Follow me @:
    Telegram: t.me/red_eyed_coder_club
    Twitter: twitter.com/CoderEyed
    Facebook: fb.me/redeyedcoderclub
    Help the channel grow! Please Like the video, Comment, SHARE & Subscribe!

  • @gisleberge4363
    @gisleberge4363 3 роки тому +1

    Real clever how you solved the "mysterious challenge", great content 🙂

  • @y.agamer3987
    @y.agamer3987 Рік тому

    The best video about requests on youtube

  • @AK-zh1co
    @AK-zh1co 2 роки тому

    Excellent video and tutorial. I really like how you walkthrough your troubleshooting and problem solving approach.

  • @usingvancedplzdontban1128
    @usingvancedplzdontban1128 4 роки тому +1

    Duddddeeee!! You make videos on awesome topics! Thanks A Ton man! Please try and make Docker + Selenium/Firefox/Chrome in the future if you can, thank you!

  • @streamdr1499
    @streamdr1499 4 роки тому +2

    Again, nice, thanks for sharing

  • @snopz
    @snopz 2 роки тому +1

    You helped me a lot thanks ❤️❤️

  • @rationalpi6755
    @rationalpi6755 3 роки тому

    Great video, thanks!

  • @brunonishimura
    @brunonishimura 2 роки тому

    Hi from Brazil!!! great job

  • @sven7327
    @sven7327 Рік тому

    Nice video!

  • @jkf114
    @jkf114 3 роки тому

    Great video!

  • @EA-br9ii
    @EA-br9ii 2 роки тому

    You're amazing. Thank you very much for sharing

  • @thegodstudent
    @thegodstudent Рік тому +1

    Thank you bro

  • @RedEyedCoderClub
    @RedEyedCoderClub  4 роки тому +12

    Let me know what topic I should cover next

    • @JJBoi8708
      @JJBoi8708 4 роки тому +5

      Can you make a video on how to buy products from a Shopify site? That would be so awesome!

    • @rakeshkumar-jk4lt
      @rakeshkumar-jk4lt 4 роки тому

      @@JJBoi8708 lol

    • @TipsyShort
      @TipsyShort 4 роки тому

      Hi what if there is no id value

    • @stealthseeker18
      @stealthseeker18 3 роки тому

      Can you do web scraping if the website behind cloudflare version 2?

    • @asifiqbal12141286
      @asifiqbal12141286 3 роки тому

      please add the code in description.

  • @ozkankurt449
    @ozkankurt449 4 роки тому

    Red Eyed Coder Club Gerçekten çok dikkatli becerikli bir kanal takipteyim...

  • @DeepDiveinUniverse
    @DeepDiveinUniverse 4 роки тому

    The conclusion was good haha

  • @response4322
    @response4322 3 роки тому

    Can I donate to you??? Because I love this video so much! Wow you helped me solve my issue.

    • @RedEyedCoderClub
      @RedEyedCoderClub  3 роки тому

      I'll appreciate for it.
      My Pay-Pal: molchanov.o.o@gmail.com
      Or you can make a donation via Patreon

  • @aap204
    @aap204 3 роки тому

    Great.
    I have question about sending a request within a website. For example in this video we want to buy a pair of shoes. When click the buy button we can see sended order in inspect (xhr).
    Now, i want to learn how to send this order without clicking the buy button in python.
    Thank you very much

    • @RedEyedCoderClub
      @RedEyedCoderClub  3 роки тому +1

      You need to use Selenium to perform such actions

  • @shreyaskarsrivastava9386
    @shreyaskarsrivastava9386 4 роки тому +5

    Hi, this video very informative! I am scraping a site where there is no visible function which encrypts the password, although under the Network tab, the password value looks to be encrypted. Any suggestions upon how to proceed?

  • @ArslanFarooqQureshi
    @ArslanFarooqQureshi 2 роки тому

    This is great.

  • @yuniorbarcelochavez6800
    @yuniorbarcelochavez6800 3 роки тому

    great video! ...

  • @nygeJIbTB
    @nygeJIbTB 4 роки тому +6

    Сразу узнал по голосу - Молчанов)

  • @arete_
    @arete_ 2 роки тому +2

    Thanks

    • @arete_
      @arete_ 2 роки тому +1

      I would love to see more practical examples like this in the future. As you know, almost every web page is different when it comes to logins and protection. These examples are gold for getting practical experience for beginners like me. Love your work. Keep it coming and I shall hopefully tip some more. Happy new year!

    • @RedEyedCoderClub
      @RedEyedCoderClub  2 роки тому

      Thank you very much! Happy new year!
      I'll try to create more videos like this one.

  • @shortcuts9005
    @shortcuts9005 2 роки тому

    Олег спасибо, хороший материал приятная подача 👍

  • @siddhartha.01
    @siddhartha.01 3 роки тому +1

    Thanks a lot man! After 100's of videos I something amazing!
    Can you scrape Userinfo(like view count followers count etc) of a Quora user without using Selenium or Requests-HTML I'm trying this since past week :(

    • @RedEyedCoderClub
      @RedEyedCoderClub  3 роки тому +1

      Thank you! I'll try it

    • @siddhartha.01
      @siddhartha.01 3 роки тому

      @@RedEyedCoderClub Thank you so much, I'm waiting for your try :)

  • @mohammadghorbani2489
    @mohammadghorbani2489 4 роки тому +3

    Hi thank you so much for the video. I am wondering if I can login into a broker website and be able to place an order with python? could you please explain briefly how? or if you have already had similar videos just kindly refer me to them. Kind Regards

    • @albertkunz6730
      @albertkunz6730 3 роки тому

      Broker pages have higher security measures so it will be more difficult to authenticate. However many broker offer APIs for its users to automate actions. They are often called something like 'trading-api'

    • @RedEyedCoderClub
      @RedEyedCoderClub  3 роки тому

      I think it's better to use API or Selenium

  • @snopz
    @snopz 2 роки тому +1

    Can you make in future videos how to scrap a website with a recaptcha without solver or selenium for free

    • @RedEyedCoderClub
      @RedEyedCoderClub  2 роки тому +1

      Thanks for the suggestion, I'll think about it

    • @snopz
      @snopz 2 роки тому +1

      @@RedEyedCoderClub ❤️❤️

  • @nasr-rsln
    @nasr-rsln 2 роки тому

    in lattest chrome versions, you cant see form data section, instead you can find the parameters under payload tab which is next to headers

    • @RedEyedCoderClub
      @RedEyedCoderClub  2 роки тому

      Thank you for the valuable comment! Will add it to the description!

  • @Romanticoneable
    @Romanticoneable 3 роки тому

    Thanks for your video man. I subscribed already. I'm trying to do web scraping of Amazon Kindle, but I need to log in first to access the page. I haven't found anything that could help me with this. Could you give me a hand here?

  • @NicolasMagneTang
    @NicolasMagneTang 2 роки тому

    Nice video, One question, for a system of login more complicates like ebay or amazon they have more complicate login protocols with tokems and encripted password. is also possible to get a way to enter with this approach? or it is better to use other method?

  • @armago55
    @armago55 2 роки тому

    Hi. Thanks for video. Amazing job. I'm trying to do one with dot freight web site and its so complicated, that they don't have any form in request. Maybe you can give some ideas? Thanks

    • @RedEyedCoderClub
      @RedEyedCoderClub  2 роки тому +1

      Try to check the requests that your browser sends to it. It can help

  • @notAvn
    @notAvn 4 роки тому

    i love ur english accent

  • @KRock921
    @KRock921 2 роки тому

    I liked how you got challenge value, but could you have made your own "challenge" value instead? If the challenge value is set on the front end and posted to the backend and unhashed there, it probably could have been any value.

    • @RedEyedCoderClub
      @RedEyedCoderClub  2 роки тому

      No, fits only the challenge value that we get from frontend. I think it uses the same algorithm on backend and frontend.

  • @Hecticam
    @Hecticam 2 роки тому +1

    If a website redirects and uses session cookies (for identification) in the main content page, is there any way of using just request library without selenium?
    I see the cookies already sent in the header of the very first GET request in Network tab, I can't find the way to generate the cookies , please help :(

    • @RedEyedCoderClub
      @RedEyedCoderClub  2 роки тому

      In this video I used Requests.Session() class to handle cookies and keep my login stated saved between requests. Whether you need to use just Requests or you need to use Selenium depends on the particular website.

  • @ridiwanemamatoure3181
    @ridiwanemamatoure3181 Місяць тому

    How you know that web site use session

  • @dereklee2590
    @dereklee2590 3 роки тому

    can u do a video of getting website login details?Lately i been trying to find video how to do that all i know is do something with ip address port

    • @RedEyedCoderClub
      @RedEyedCoderClub  3 роки тому

      I didn't get your question. Login details? What did you mean?

  • @TheSupernatural72
    @TheSupernatural72 2 роки тому

    I tried exact same things and on my website i even have not any challenges, but the only challenge for me is im getting a cloudflare protection "access denied" cause it cant pass captcha from cloudflare.
    I'm using user agent for that yes.
    No matter how i tried, couldnt find an answer for that.
    Could you possibly teach that on one of your videos please?
    Thanks in advance.

    • @RedEyedCoderClub
      @RedEyedCoderClub  2 роки тому

      It depends on the website. Sometimes the method I have shown works, sometime it is not. If the website show you the captcha (Google recaptcha) it's barely possible to solve it. All we can do is to try to avoid of getting captcha.
      Google's recaptcha is a quite complex thing, that determines whether you're bot or not by analyzing you browsing history and saved cookies.
      Probably it's better to use Selenium.

    • @RedEyedCoderClub
      @RedEyedCoderClub  2 роки тому

      By the way what website you tried?

  • @gayashan99
    @gayashan99 3 роки тому

    i found so useful things in your channel. so i subscribed you. i stucked at copying magent link in file cr website. can you tell you me how to do that :|

  • @vetrivelr5011
    @vetrivelr5011 2 роки тому

    you simply superb! awesome explanation! Thanks you so much!
    Can we login if a website require "Soft Token" login?
    Basically at first time login it asks for "Login", "Password" and it re-direct us to second login page where we need to enter "SOFT TOKEN" (do change every 30 seconds). Once that successfully done it re-direct to Main page/Secure area.
    Like gmail has 2 way authentication login.
    Is that possible? Kindly help me! Must have figured this out somehow. Please please help!

    • @RedEyedCoderClub
      @RedEyedCoderClub  2 роки тому

      Thank you,
      Redirects are supported by Requests by default. The main problem here is the getting of tokens. If you will find the valid tokens, then it's probably possible to use Requests for authorization on such websites.
      It's hard to say something definitely, the task requires a lot of experiments.

  • @_popbob
    @_popbob 3 роки тому +1

    what if a login had a captcha? how do you bypass that?

    • @RedEyedCoderClub
      @RedEyedCoderClub  3 роки тому

      You need to avoid getting of captcha. You can solve/bypass simple ones, but not Google's reCaptcha.

  • @Kilogya
    @Kilogya 4 роки тому

    The power of automation got me back into coding. I was a VB.net programmer, but you can guess how boring that got.

    • @Kilogya
      @Kilogya 4 роки тому

      Thanks for the pin, I've never been pinned so it made my day 🙂

  • @huyhoangnguyen7465
    @huyhoangnguyen7465 Рік тому

    I want to login and dowload file with python ???

  • @leandrosl86
    @leandrosl86 4 роки тому

    interesting, i looking for a solution to made login in a website using request library, however, i would like if know is possible make login session using this method and call Selenium using the same session loged in the website?

    • @RedEyedCoderClub
      @RedEyedCoderClub  4 роки тому

      If you have to use Selenium, why don't you want to use it to login?

    • @leandrosl86
      @leandrosl86 4 роки тому

      @@RedEyedCoderClub because in specific situations, I need to press a button to activate a javascript function to load the next page. in some cases, I can get data to navigate over the direct link from the page. I long time ago I searched to resolve this problem over lib request, but I cannot found it any solution for this. Actually, exist any solution to navigate through pages?
      (about your question)
      Using Selenium method is more slowly.

  • @no-user-cw2md9sp9w
    @no-user-cw2md9sp9w 4 роки тому +3

    Олег Молчанов

  • @capo8506
    @capo8506 2 роки тому

    hello, I'm receiving this response trying to login to a website. any help please.
    "Invalid auth token. Please refresh the page and try again."

    • @RedEyedCoderClub
      @RedEyedCoderClub  2 роки тому

      So, you have to provide an auth token. Whether the token is on the page or not - depends on the website you're trying to scrape

  • @multigladiator384
    @multigladiator384 3 роки тому

    Okay, but what can i do if the post request is somehow hidden, when I sniff the traffic with my dev tools and click on the login button, the first request method is actually GET
    The POST request must happen somewhen before.'
    The Login Button has an "onLoginClick($event$) in it. I guess I need to find out what happens there to find the POST request

    • @RedEyedCoderClub
      @RedEyedCoderClub  3 роки тому

      I didn't get your question. In the video I showed all action I have performed to get all needed hidden fields. For other websites steps can be different.
      You have to find all hidden fields on the page. Try to disable cache for requests, and check the preserve log option in settings of the Inspector.

  • @moisesmasis1981
    @moisesmasis1981 3 роки тому

    It would be good to know how to make the login in the background and that the system only loads the final page and not that it travels everywhere

    • @RedEyedCoderClub
      @RedEyedCoderClub  3 роки тому

      I didn't get your question.

    • @moisesmasis1981
      @moisesmasis1981 3 роки тому

      @@RedEyedCoderClub It would be interesting if you could make an automatic login that is a background and only show the web after Scrapping and that you execute it in an IIS

  • @howiewhite4773
    @howiewhite4773 3 роки тому

    aren't you basically just logging in still but through your code? its not like your hacking in when your still uploading your user and pass in the form data...

    • @RedEyedCoderClub
      @RedEyedCoderClub  3 роки тому

      Did you notice these little quotes around the Hacker word? The hacker here means the way of thought to bypass the protection. And nothing more.

  • @EVILMAJNU
    @EVILMAJNU 2 роки тому

    Sir How To Use Google Recaptcha Same Response Token Again 👍😭

    • @RedEyedCoderClub
      @RedEyedCoderClub  2 роки тому

      ReCaptcha is very tough thing. ReCaptcha uses your cookies, your search history and other stuff to determine whether you are a bot or a human. Don't know how to deal with it properly. Obviously the Requests is not the tool you need for it.

  • @vladislavbadovskyi1666
    @vladislavbadovskyi1666 3 роки тому

    Hey, thx for awesome content, can you please make video about ajax buttons like on olx.pl (click the button to view phone)

  • @tumtac4544
    @tumtac4544 3 роки тому

    how do you web scrape a website that stops your scraping with a cloudfare protection

  • @alexdin1565
    @alexdin1565 2 роки тому

    thanks how we can login to gmail using this method

    • @RedEyedCoderClub
      @RedEyedCoderClub  2 роки тому

      I'm not sure that is possible to login to gmail using this method. I'm not sure that's possible even with Selenium. Google is too strict. This method is not a silver bullet, but it can work for certain websites.

  • @tolulopeayemobola1446
    @tolulopeayemobola1446 2 роки тому

    Hi. Thank you so much for the video. I have a few questions I would like to ask. What email address can I direct my questions to? Looking forward to hearing from you

    • @RedEyedCoderClub
      @RedEyedCoderClub  2 роки тому

      If you have a question it's better to ask it here - in comments.

    • @tolulopeayemobola1446
      @tolulopeayemobola1446 2 роки тому

      @@RedEyedCoderClub Thank you so much for your response. I have a site that I would like to try your techniques on. That's why I wanted to contact you. Anyways, as part of my graduation from a training school, I am working on an aggregator and this would require me pulling data from my own personal banking apps. This is where I was been researching and seeking help. What do you say?

  • @thisismyescape4373
    @thisismyescape4373 2 роки тому

    You are a fucking genius lol😂😂😂

  • @jonnikwest6630
    @jonnikwest6630 3 роки тому

    This approach does not seem to work anymore, and I can't figure out why... Has anybody tried it recently or have any ideas?

  • @nazarkravchenko989
    @nazarkravchenko989 3 роки тому

    Спасибо)

  • @abirhasan8315
    @abirhasan8315 3 роки тому

    pDisk.net Login & File upload tutorial please 👀

  • @friend1439
    @friend1439 4 роки тому

    Sir how to contact you? I'm trying to scrape a movies website with your code but it is returning nothing but a pycache folder.

  • @ruiruihuang
    @ruiruihuang 3 роки тому

    what if there is no login file found in the inspect?

  • @iredeyes-4351
    @iredeyes-4351 4 роки тому +1

    Autobuy script for Realme.com as soon as the stock comes

  • @vishnudas1791
    @vishnudas1791 3 роки тому

    Could we inspect these details with any websites

    • @RedEyedCoderClub
      @RedEyedCoderClub  3 роки тому

      yep

    • @vishnudas1791
      @vishnudas1791 3 роки тому

      @@RedEyedCoderClub which website ???
      Am coding in adroid with jupyter)so it's a bit hard could please share where I can inspect these details

    • @vishnudas1791
      @vishnudas1791 3 роки тому

      Am asking was there any other option to inspect these details from websites

    • @vishnudas1791
      @vishnudas1791 3 роки тому

      I hope you got
      Bad English😁

    • @RedEyedCoderClub
      @RedEyedCoderClub  3 роки тому

      You were asking: "Could we inspect these details with any websites".
      Yes, you can inspect any website.
      Consider to buy a cheap or used laptop - it makes you more productive, instead of using Android and Jupiter.

  • @wasifhjff294
    @wasifhjff294 3 роки тому

    Amazing video.
    But i am fail to make fiverr.com website auto login script.
    Can you make a video for this.
    Can i contact you?

  • @djangopython3051
    @djangopython3051 Рік тому

    18:08 Это не weird :) просто надо было использовать `global username` но я думаю ты и сам знаешь)

    • @RedEyedCoderClub
      @RedEyedCoderClub  Рік тому

      а вот и нет. Откуда там global username?

    • @djangopython3051
      @djangopython3051 Рік тому

      @@RedEyedCoderClub 17:59 на 22 строке ты пытаешься присвоить локальной переменной её же username = username + ':'
      Python ожидает, что username внутри функции будет локальной переменной. Соответственно, он ищет, где она объявляется в функции. А она не объявлена. Python падает с ошибкой.
      На что ты и получаешь ошибку UnboundLocalError: local variable 'username' referenced before assignment.
      Я понимаю что ты хотел изменить переменную username которую импортировал, но пайтон об этом не знает, поэтому ему необходимо указать с помощью global username после 21 строки.

    • @RedEyedCoderClub
      @RedEyedCoderClub  Рік тому

      @@djangopython3051 Все верно расписал, так и было. Но про global username мне даже в голову не пришло. Ни тогда, ни сейчас.

  • @GoodBoyDanny
    @GoodBoyDanny 4 роки тому +2

    Everytime I use selenium or requests on python on this site yeezysupply .com I get banned off the site (can't click any elements) Could you make a video on this?

    • @amoamo2647
      @amoamo2647 4 роки тому

      Not that simple to bot it you will need to inject genned cookies

    • @mandeelev7221
      @mandeelev7221 4 роки тому

      Use user agent of your web browser coz some websites detects the bots

    • @iLLestTv
      @iLLestTv 4 роки тому

      Yep. Same shit for me months ago. I was getting closer to the answer, I believe it has something to do with cookies or the user agent. Must manipulate the 2

    • @amoamo2647
      @amoamo2647 4 роки тому

      They have v3 captcha as well so if your not grinning a key for that it won’t go through either

    • @Christian-mn8dh
      @Christian-mn8dh 3 роки тому

      @@iLLestTv i believe it may be you needing to add a user agent within your request. Try this

  • @wasiindia8815
    @wasiindia8815 3 роки тому

    Osam!
    All other websites it will work
    But this method not working in fiver.com
    Please help

  • @abhisheksunda7925
    @abhisheksunda7925 3 роки тому

    awesome!! can you make a video on how to scrap " recent submissions" from leetcoode.com?

    • @RedEyedCoderClub
      @RedEyedCoderClub  3 роки тому

      Thank you! Thanks for your suggestion, I'll look at it.

  • @EnglishRain
    @EnglishRain 4 роки тому

    At 0:45 you say "without using Selenium webdriver". Any reason for not using Selenium? As per my experience, using a saved Firefox/Chrome profile with Selenium webdriver to gain access is much more simpler & quicker. So why not use it? Is there any advantage of using just requests library?

    • @libs1213
      @libs1213 4 роки тому +2

      There are many advantages, most importantly Requests library is much more lightweight, which means you can run multiple scraping instances without consuming much RAM.

    • @andkiek
      @andkiek 4 роки тому +4

      Selenium it's not quicker, it's so heavy and unpractical in my opinion

    • @RedEyedCoderClub
      @RedEyedCoderClub  4 роки тому +5

      Yep, I prefer Requests wherever it's possible to use, because Selenium is slow... even headless Selenium.

    • @EnglishRain
      @EnglishRain 4 роки тому

      @@RedEyedCoderClub Understood... thanks guys for all the explanations.

    • @VuNguyen-ni4ex
      @VuNguyen-ni4ex 4 роки тому

      How selenium quicker than requests, have u tried both?