API Endpoints? Get data from the web easily with PYTHON

แชร์
ฝัง
  • เผยแพร่เมื่อ 8 ก.ค. 2024
  • This is another way to web scrape with Python. Find where the website gets its data from and then mimic this request programmatically.
    Postman: www.postman.com/
    Insomnia REST Client: insomnia.rest/
    -------------------------------------
    twitter / jhnwr
    code editor code.visualstudio.com/
    WSL2 (linux on windows) docs.microsoft.com/en-us/wind...
    -------------------------------------
    Disclaimer: These are affiliate links and as an Amazon Associate I earn from qualifying purchases
    mouse amzn.to/2SH1ssK
    27" monitor amzn.to/2GAH4r9
    24" monitor (vertical) amzn.to/3jIFamt
    dual monitor arm amzn.to/3lyFS6s
    microphone amzn.to/36TbaAW
    mic arm amzn.to/33NJI5v
    audio interface amzn.to/2FlnfU0
    keyboard amzn.to/2SKrjQA
    lights amzn.to/2GN7INg
    webcam amzn.to/2SJHopS
    camera amzn.to/3iVIJol
    gfx card amzn.to/2SKYraW
    ssd amzn.to/3lAjMAy
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 63

  • @amineboutaghou4714
    @amineboutaghou4714 4 ปีที่แล้ว +13

    Great video John - many thanks for sharing.
    it's been months that I was trying to scrape a hotel booking engine and I could not do it through the classic way. I managed to do it with Selenium, by it was very slow and plenty of errors were happening.
    Thanks to this video I managed to get the data straight from the API and thousands of data are scrapped within seconds and with very high accuracy.
    Again many thanks and hopefully you will continue sharing these great skills !

  • @maskahleo
    @maskahleo 3 ปีที่แล้ว +5

    Thanks John, you really made it simple. Liked , Subscribed and smashed the notification bell.

  • @paulmaloney585
    @paulmaloney585 ปีที่แล้ว +4

    Thanks so much for this! This was a massive life saver for a project I am working on

  • @wangdanny178
    @wangdanny178 2 ปีที่แล้ว +1

    Hey John Thanks for the video.
    BTW, I watched the sunglass and livescores episodes. I think this way of getting data is my new one. THANKS!

  • @cyborg69420
    @cyborg69420 ปีที่แล้ว +1

    you are the man who actually taught me something
    [

  • @gisleberge4363
    @gisleberge4363 3 ปีที่แล้ว +2

    Real interesting...alternative to what I so far have considered webscraping. COOL. Thanks for the effort.

  • @mariadaza3579
    @mariadaza3579 ปีที่แล้ว

    You are a genius at explaining python!

  • @isam789
    @isam789 ปีที่แล้ว +3

    Just watched this video and have subscribed. Exactly what I was looking for as I am learning Python now for a career change. Thank you and look forward to watching more videos in my journey

    • @JohnWatsonRooney
      @JohnWatsonRooney  ปีที่แล้ว +1

      Thank you I have lots of more videos planned I think you will enjoy

    • @isam789
      @isam789 ปีที่แล้ว

      @@JohnWatsonRooney Thank you excited for them. Just a quick question, I use Chrome and have been playing around with the chrome dev tool. Is there a video that explains how to optimise scraping using that and Python?

  • @EmirTT
    @EmirTT 4 หลายเดือนก่อน

    what a great video. I was having a time problem while scraping with selenium and with the help of this video I solved it thx.

  • @thatolebethe3238
    @thatolebethe3238 2 ปีที่แล้ว +1

    This video saved my life for a job. Thanks mate

  • @patriciodiaz2377
    @patriciodiaz2377 2 ปีที่แล้ว +1

    Thank you very much for the info!

  • @quangtuan202
    @quangtuan202 ปีที่แล้ว +1

    Thank you so much! You are my life saver!

  • @higiniofuentes2551
    @higiniofuentes2551 ปีที่แล้ว

    Thank you for this very useful video!

  • @JustJoelTV
    @JustJoelTV 3 ปีที่แล้ว +4

    Thanks for this John! Smashed the like button

  • @sinamobasheri3632
    @sinamobasheri3632 4 ปีที่แล้ว +3

    loading entire page with selenium is awful its very slow for scraping bunch of data specially when you need speed up work as well as you can this method it way better than selenium
    thanks you again sir 🖤🙏🏻

  • @sinamobasheri3632
    @sinamobasheri3632 4 ปีที่แล้ว +6

    you change my life sir thank you for this great information 🖤🖤🖤🖤🖤🖤🖤🖤🍻🍻🍻👌🏻👌🏻🍻🍻🍾🍾🍾🍾

  • @carloseortega
    @carloseortega ปีที่แล้ว +1

    Thanks. Been learning a lot from your videos. Question. What do you do when the API requires an auth token like a Bearer token? Thanks

  • @sampathkumar-yp8hp
    @sampathkumar-yp8hp 3 ปีที่แล้ว +2

    Thanks, helpful!

  • @juleswinnfield1437
    @juleswinnfield1437 2 ปีที่แล้ว +1

    Hey, great video - thanks! I have a question, I'm trying to build an app ontop of a website. Is it possible to locate the API used to make user accounts, for example? Would I be able to post my own data to their API to make an account. Thanks :)

  • @martpagente7587
    @martpagente7587 4 ปีที่แล้ว +5

    Hi John, I wish you can create more example of this kind of scraping data from a website, getting data through API Endpoints, I'm stuck here now, this is the trickiest way of scraping data I think, it requires more investigation, so very much appreciated if you can create more examples like this.

    • @JohnWatsonRooney
      @JohnWatsonRooney  4 ปีที่แล้ว +3

      Hi Mart - sure I have some videos coming up to show multiple ways to scrape the same website so this will be covered again.

  • @themilkyway4525
    @themilkyway4525 2 ปีที่แล้ว +2

    How can I acces specific element from this result ? Result format is like string, There is no dictionaries or something, so I can`t acces for example if I want only 'Names' or something like this...

  • @tokoindependen7458
    @tokoindependen7458 3 ปีที่แล้ว +4

    this the most exactly what i looking for, imsomnia doing good job, simple and work, i try postman it failed respon my curl header

  • @benjibo6451
    @benjibo6451 ปีที่แล้ว

    Very useful! I'm stuck on one thing though. I need to extract a cookie from a network request that happens after I make my initial request. I can't make this request directly. Is there any way to inspect sub-requests like this with Python?

  • @andyrothwell
    @andyrothwell 4 ปีที่แล้ว +2

    This is great, thanks! What are the benefits of going through postman/insomnia rather than just using the endpoint directly in requests.get(url)?

    • @JohnWatsonRooney
      @JohnWatsonRooney  4 ปีที่แล้ว +2

      Thanks Andy! Postman makes it easier to tailor the request exactly how you want it by quickly changing parameters. Although I didn’t change anything in my example when you start to work with APIs more you see the benefits!

  • @basicallytrying7856
    @basicallytrying7856 ปีที่แล้ว +1

    Help me a lot

  • @rshrott
    @rshrott 2 ปีที่แล้ว +1

    Please do airbnb next!

  • @Semihszy
    @Semihszy ปีที่แล้ว

    thnaks man another great video! i am trying to use scrapy for a similar website (oddsportal1) but the URL of request keep changing by time and by each item so is there a way i can use the page URL and catch the req URL by a partial match? or is there another way to reach the jason data of each item in a list on the main page ? thanks again for such a good content i really feel like i owe you something :)

  • @sifat19
    @sifat19 ปีที่แล้ว +1

    on point!

  • @user-kk2kt3qf3e
    @user-kk2kt3qf3e 6 หลายเดือนก่อน

    Hi John, I am trying to get the information from Network > XHR, but there is any request with JSON data retrieved, what can i do?

  • @eric24g
    @eric24g 2 ปีที่แล้ว +1

    what if you don't see the json data in the webpage when you are inspecting. I notice some websites don't show it. Are some sites just hiding that data or is there a workaround for that. Thanks

    • @JohnWatsonRooney
      @JohnWatsonRooney  2 ปีที่แล้ว +1

      That site may either be hiding it well, or not using this method. My best advice is to open the network tab and start clicking on links on the site, best ones to check are next pages or load more, and see what comes up

    • @eric24g
      @eric24g 2 ปีที่แล้ว

      @@JohnWatsonRooney thanks for your response. 🙏🙏

  • @liviuchristianfotache1172
    @liviuchristianfotache1172 ปีที่แล้ว +1

    Hi, I'm looking for an automated way to discover public API endpoints, not the manual version (inspect - network - XHR). Could you help me with any clue if there is an open source piece of software that does API endpoints search & discovery?

    • @JohnWatsonRooney
      @JohnWatsonRooney  ปีที่แล้ว

      You can use a automated browser to load the page and have it dump out any requests made - this will show what you are after I think. I can’t remember the exact name but it’s definitely there. I have a playwright video on it on my channel

  • @aaammm1888
    @aaammm1888 3 ปีที่แล้ว

    Hi Pal
    I want to Build a website where all the crypto rates of staking apy are I found
    all the endpoint api I have about 35 api which i want to get the data from cron 30mins
    and save the data i need to my database then make a simple frontend so I can find the
    best rate and the platform How can I go on about this

  • @WalkingWRPT
    @WalkingWRPT ปีที่แล้ว

    When I do this on Mac, I get the code but nothing in the output. My friend does the exact same on Windows, and runs it, and get the data outputted. Is there a method for mac?

  • @jendrik3495
    @jendrik3495 ปีที่แล้ว +1

    Hi John, again really great video! I tries this method for a sports website but it returns a 403 error. Do you have any idea on how to solve this?

    • @JohnWatsonRooney
      @JohnWatsonRooney  ปีที่แล้ว

      Thanks, 403 is forbidden, make sure you are copying all the headers over too including the cookie part and it should work

  • @Kralnor
    @Kralnor 25 วันที่ผ่านมา +1

    After both Postman and Insomnia have become more walled in tools requiring you to have an account, are there any other similar tools that you would recommend nowadays?

    • @JohnWatsonRooney
      @JohnWatsonRooney  24 วันที่ผ่านมา +1

      Yeah it’s a shame, I don’t use either anymore - I just use httpx, it has a cli tool and I do it from the terminal

  • @superadam908
    @superadam908 2 ปีที่แล้ว

    how to get json url in mobile android?

  • @muhammadirshad7497
    @muhammadirshad7497 ปีที่แล้ว +1

    which browser you are using i am hoping that aap by chrom but every thing is changed

    • @JohnWatsonRooney
      @JohnWatsonRooney  ปีที่แล้ว

      this is old but i think its firefox, i usually use chrome now for this sort of thing though

  • @edinhofilho22
    @edinhofilho22 2 ปีที่แล้ว

    Hi, I love your tutorials, could you help me, how can I use this wonderful information to create an API from scratch? I know programming, but I don't know where to start a Scrap API, I mean, an API of its own, where my data would come from these endpoints that you explained. Thanks John for the content

    • @JohnWatsonRooney
      @JohnWatsonRooney  2 ปีที่แล้ว +1

      Hey! What I do is create scripts to fill a database at a certain time/times of day, then use a framework like django rest framework or flask to then serve your own api endpoints. Hope that makes sense

  • @thatolebethe3238
    @thatolebethe3238 2 ปีที่แล้ว +1

    How can u solve if insomnia is blocked by website. I.e saying that I'm a suspected robot when doing the curl request?

    • @JohnWatsonRooney
      @JohnWatsonRooney  2 ปีที่แล้ว +1

      Did you copy all the headers including the cookie?

    • @thatolebethe3238
      @thatolebethe3238 2 ปีที่แล้ว

      So basically. I copied the API endpoint as curl pasted it into insomnia. Then I get suspected robot notification where the Json should be. Website in question is infojobs.net you can search data analyst

  • @albinmiftari1832
    @albinmiftari1832 ปีที่แล้ว +1

    Why do you need postman/insomnia? I always just get the JSON with requests and get the data that way.

    • @JohnWatsonRooney
      @JohnWatsonRooney  ปีที่แล้ว +1

      You don’t need it - it just helps see what is going on and a chance to see if you can change some of the parameters. Its also an easy way to generate initial code

  • @lordlegendsss7776
    @lordlegendsss7776 7 หลายเดือนก่อน

    Where to find amazon api

  • @saeedjudia6850
    @saeedjudia6850 3 ปีที่แล้ว +2

    🙏

  • @john-r-edge
    @john-r-edge 2 ปีที่แล้ว

    John. This is useful. But how to handle authentication with Insomnia? I have to sign onto the site of interest using a username and password.
    I logged in using Chrome, and located the correct xhr line in Network which corresponds to the table data being returned. So I copied the request as you demonstrated via Copy -> Curl, and pasted that as a new Get request Taking a look at the data copied and pasted - it includes multiple lines including a line containing a cookie. The cookie line starts like this
    -H "Cookie: __Host-nc_sameSiteCookielax=true; __Host-nc_sameSiteCookiestrict=true; oc_sessionPassphrase=
    However when I send this, the response is either "401 unauthorised" or some xml saying "Current user is not logged in".
    Only thing a bit different was that i could copy as :"curl (bash)" or as "curl(cmd)"
    Thanks

    • @john-r-edge
      @john-r-edge 2 ปีที่แล้ว +3

      I worked it out - i found a feature in Insomnia which fixed the problem. I pasted in the request but Insomnia gave errors. I found the "Auth" tab, and selected the "Basic" method - and Insomnia gives a dialog to add a user id and password. Then it finally connected ok with the right cookies

  • @dananjayachathuranga7113
    @dananjayachathuranga7113 ปีที่แล้ว

  • @satyamvirat3489
    @satyamvirat3489 6 หลายเดือนก่อน +1

    That is incredible. I was just looking for this info.
    Thnks a knowledge for this man.
    Subscribed 🫂