BeautifulSoup 4 Python Web Scaping to CSV Excel File

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

КОМЕНТАРІ • 77

  • @hibaal-aani2661
    @hibaal-aani2661 3 роки тому +4

    Hi , in case of I using python 3 so what about urllib? Which one i need to work ?

  • @e.d.r1546
    @e.d.r1546 4 роки тому +1

    This video is awesome. Fast and straight to the point, this helped me to make a script for a company, thanks. Subscribed

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

    trying to scrape data from Indeed's job postings and your video helped a bunch. thanks for the help my dude

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

    Thanks, Holland.

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

    Not gonna lie, you taught this better than my professor did. Thanks man!

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

    The video is really good, Mr Peter Parker

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

    What to do when there is ng_content in class. For when I print it out nothing comes

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

      I'm not sure the specifics of your situation but usually ng prefixes mean the site is using angular. Javascript SPAs can be difficult to scrape as the javascript is not run and content may be missing, you may want to explore other routes such as seeing if there is a web request pulling the content in after the page loads and seeing if you can scrape directly from that.

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

    Mine just ends up with this:
    print username + ' ' + uploads + ' ' + views
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?

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

    Thanks, Peter P. :)

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

    How can we create another sheet (tab) within the same csv file.... Can u please share that

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

    I am getting an error Attribute:"None type" object has no attribute 'find_all'
    How to solve this?

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

    I'm using the requests lib instead of urlib2 and social blade is blocking me with cloudflare
    any tips?

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

    At 17:39, i'm getting an error after i type the line saying:
    TypeError: a bytes-like object is required, not 'str'
    I have exactly what you have

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

      @Lenovo P70 Phone sir i have error is 'NoneType' object has no attribute 'find_all'

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

      @Lenovo P70 Phone sir please share your write code
      Please sir 🙏🙏🙏🙏

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

      @Lenovo P70 Phone also I tried this and worked for me. It took me while to figure this out:
      file = open('UA-camr.csv','w',encoding='utf-8',newline=' ')
      writer.writerow([username, upload, views])
      So, basically don't use the .encode

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

    I'm not able to convert imported data into number format from text format, having issues with vlookup due to this. Any quick fix or video that you have on it? I've already tried quite a few options but no success.

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

      Looks like doing Text to Columns in Excel is what you want my friend: support.office.com/en-us/article/Convert-numbers-stored-as-text-to-numbers-40105f2a-fe79-4477-a171-c5bad0f0a885

  • @ishtislife475
    @ishtislife475 Рік тому +2

    from the side you almost look like Tom Holland 😁

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

    How do we scrap from a inspect element disabled page

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

    heyi just got this error could please find solution to this
    error:-Traceback (most recent call last):
    File "main.py", line 28, in
    writer.writerow(['ProductName','Price'])
    TypeError: a bytes-like object is required, not 'str'

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

      yeah i had the same error, appearantly we put in the header as strings, but py wanted it as a bytes. its been a year, do u got any solutions to that?

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

    Sir, which software do you used to execute??

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

    Yoo I don't know Spider-Man could teach you about programming

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

    Nice tutorial man...Greatjob

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

    hi can you upload video how to get information from html inside the hyperlinks

  • @L.A.X24
    @L.A.X24 4 роки тому

    I'm getting this error: AttributeError: module 'urllib3' has no attribute 'Request'

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

      Two changes might help you.
      Import requests
      request = requests.get(url)

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

    Thx a lot. It really helped

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

    Nice ! Thank You

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

    you deserve my like

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

    type error: a bytes-like object is required, not 'str, hailp

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

      Remove the b in wb in the file open

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

    helped indeed! thanks

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

    men god bless you, just one thing, did you know why some letters doesnt appear, i mean, i put the UFT-8 but some code missing

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

    using ur code i'm getting error in this line
    for row in rows:
    for row in rows:
    ^
    SyntaxError: unexpected EOF while parsing
    ps: i'm using Spyder anaconda v3.7

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

      Did you indent the next block of code correctly? The next line should be indented.

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

    Superb👍👍

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

    thanks, sir It's really good tutorials. If you give me more python web scraping tutorials then good for me

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

    Hi SyntaxByte, the link for the python book is broken, can you update? Cheers on the video, super clear and great explanations !

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

    Awesome

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

    amaaaaaaaaaaazing

  • @stephennaylor482
    @stephennaylor482 5 років тому

    Struggling a bit to actually read your code. It's very small even on full screen.

    • @syntaxbyte
      @syntaxbyte  5 років тому +3

      Which is exactly why there is a link to it in the description.

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

    how to install urllib2?

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

      You don't need to download it, it comes with Python. If you're using version 3 (hopefully you are at this point) you can use urllib. Check the docs because it may have a slightly different interface: docs.python.org/3/library/urllib.html

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

      @@syntaxbyte Thanks, I can try to do scraping now :)

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

    if tom Holland could code

  • @yamostudio1029
    @yamostudio1029 5 років тому

    ModuleNotFoundError: No module named 'urllib2'

    • @syntaxbyte
      @syntaxbyte  5 років тому

      What version of python are you using?

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

      @@syntaxbyte 3.6

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

      do you have requests installed?
      pip install requests

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

      @@fawadh Use urllib3. That's what I had to do.

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

    Give the guy a beer. Thanks for the tutorial.

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

    Hello handsome guy :D

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

    3:29 for a great slurp

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

    u look like tom holland

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

    just Spiderman (Tom Holland) WEB scrapping.

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

    He looked like Tom Holland

  • @timohelasvuo9650
    @timohelasvuo9650 5 років тому

    Liked the video but you gotta stop drinking from that clunky mug.. killer to anyone on headphones.

    • @syntaxbyte
      @syntaxbyte  5 років тому

      Lol, good to know, thanks!

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

    waste of time nothing worked

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

    bhai tu pehle coffee pile... na na pile pehele... bakchodi kiye ja raha he

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

    I am getting this error
    writer.writerow = website.encode('utf-8')
    AttributeError: 'NoneType' object has no attribute 'encode'
    How to solve it?

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

      Seems like your website variable isn't initialized properly. I can't know without seeing more code.

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

      @@syntaxbyte import requests, csv, time, webbrowser
      import re
      import row as row
      from bs4 import BeautifulSoup
      from selenium import webdriver
      user_input = input("enter something to search:")
      print("googling...")
      google_search = requests.get("www.google.com/search?q=" + user_input)
      soup = BeautifulSoup(google_search.text, 'html.parser')
      # print (soup.prettify())
      csvFile = open('juliuskoch.csv', 'wt')
      writer = csv.writer(csvFile)
      # write header row
      writer.writerow(['website'])
      for link in soup.find_all('a', href=True):
      website=print(link.get('href'))
      writer.writerow([website.encode('utf-8')])
      csvFile.close()
      This is my code I am getting error

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

      Your indentation on the for loop is incorrect. You need to indent the line that gave you the error so it is part of the for loop