Python Scrapy Tutorial - 9 - Extracting data w/ CSS Selectors

  Рет қаралды 85,319

buildwithpython

buildwithpython

Күн бұрын

In this video we will scrape quotes from a website and select elements that need to be scraped using CSS Selectors. We will also learn about the tool called as Selector Gadget that is going to make your life so much easier!
Summary
1) Using CSS selectors
Using scrapy shell
response.css('title')
response.css('title').extract()
response.css('title::text').extract()
response.css('title::text')[0].extract()
response.css('title::text').extract_first()
2) Selector gadget on quotes website
3) Selector gadget on amazon
Next video - Extracting data using XPATH
• Python Scrapy Tutorial...
Full playlist - • Python Web Scraping & ...
Subscribe - / @buildwithpython
Website - www.buildwithpython.com
Instagram - / buildwithpython
#python

Пікірлер: 115
@Fmorrell100
@Fmorrell100 3 жыл бұрын
Really great tutorial. He goes through it step by step in order, so you have a clear understanding. That helps a lot
@onksgk
@onksgk 4 жыл бұрын
You just made my day! From last 2-3 days I am trying to learn web scraping but there are complicated videos on other channels .Today I watched your first 3 videos and then I got it you are going to kill it🔥🔥 and now suggesting that tool ...it became 💎💎. Thank you. You have one more subscriber.
@Nirmal_rai
@Nirmal_rai 10 ай бұрын
bro really you are so underrated. bro you are teaching so well that i ,a mechanical engineering is doing this like its nothing. keep the hard work on . i love your videos and your teching style
@devang1956
@devang1956 4 жыл бұрын
You just gave me a breather with the Chrome Extension. Amazing video series! Keep up the good work. You earned a subscribe :)
@MarsLanding91
@MarsLanding91 4 жыл бұрын
Wow. I was going to wait until the last video to comment but I had to do it now. THANK YOU for these videos! They are SUPER helpful.
@NirmalSilwal
@NirmalSilwal 3 жыл бұрын
your explanations are amazing, very engaging and interesting stuffs
@debruppaul8239
@debruppaul8239 Жыл бұрын
Bhiya I don't know how to thank you great job and thanks a lot,you just made selecting piece of cake,thanks again
@asifmohammed1270
@asifmohammed1270 4 жыл бұрын
I wish I found this video much earlier. Just saved a lot of time and effort.
@echezonaazubike8054
@echezonaazubike8054 4 жыл бұрын
i have subscribed you nailed it bro i am Nigerian and we loved Indians
@jerinfrancis4509
@jerinfrancis4509 5 жыл бұрын
oh my god ! how am I gonna pay you back. YOU JUST MADE MY DAY. Speechless. The chrome extension is damn good bro. Thank you so much for this particular video !!!!
@buildwithpython
@buildwithpython 5 жыл бұрын
Glad I could help.
@zeeshanshani8896
@zeeshanshani8896 3 ай бұрын
Hey, great tutorial bhai ! What i get from it is that by using shell command on the terminal we can dynamically scrape data like we do with python request and beautiful soup. Thanks for uploading them.
@PMDJBMS
@PMDJBMS 5 жыл бұрын
I'm really finding your work helpful for a research project I'm on in the UK. A big thank you for your excellent videos
@buildwithpython
@buildwithpython 5 жыл бұрын
Glad I could help.
@LV7agent
@LV7agent 2 жыл бұрын
a really good hands-on tutorial, 10x alot
@5caioc
@5caioc 3 жыл бұрын
Incredible series!!!! Thanks a lot!! The extension you recommended is extremely helpful
@danielhoyos6788
@danielhoyos6788 3 жыл бұрын
Why am I getting an empty list when scraping Amazon?
@truverol8205
@truverol8205 2 жыл бұрын
wow your tutorial is so great! good job
@rhn122
@rhn122 4 жыл бұрын
Once again, great tutorial! Clear and straightforward!
@sgerodes
@sgerodes 3 жыл бұрын
Your tutorial is pure magic. Thank you very much!
@linusjohansson3164
@linusjohansson3164 3 жыл бұрын
How do you get the last command in pycharm? Up does not work here for me. I have to write response...etc all over again which is annoying.
@simasj1
@simasj1 5 жыл бұрын
Nice! The video is so clear, I think you should consider a lecturer carrier! You have a gift to explain complicated things very simply.
@simasj1
@simasj1 5 жыл бұрын
P.S. www.buildwithpython.com does not work - it says "The account for this site no longer active. This content is not currently available."
@buildwithpython
@buildwithpython 5 жыл бұрын
Yeah it's not up. I didn't know people were even checking it out!
@RobertRoman
@RobertRoman 4 жыл бұрын
This video is Gold! I'm excited to learn web scraping now :D
@buildwithpython
@buildwithpython 4 жыл бұрын
Glad I could help.
@babuji010
@babuji010 5 жыл бұрын
Nicely explained 👍. Thanks. Have a question. It looks like the "response" object under "Available Scrapy objects:" is responsible for response.css. is that right? There is no "response" object in the list for the web link I try to work on. Any suggestions? Ideas? Please.
@nathanheath3756
@nathanheath3756 5 жыл бұрын
Subscribed! Very helpful information ! definitely keep these videos coming!
@whayAl
@whayAl 3 жыл бұрын
many thanks for all your teachings
@cstech2364
@cstech2364 2 жыл бұрын
Thank You So Much Sir 👍👍
@VigneshSahoo
@VigneshSahoo 4 жыл бұрын
Selector gadget is awesome. Thanks mate.
@web-dev-zargo
@web-dev-zargo 11 ай бұрын
OMG! IT IS WONDERFUL!
@umerimran3833
@umerimran3833 2 жыл бұрын
Brother you're outstanding
@morganv3732
@morganv3732 5 жыл бұрын
Pure Gold. Thank you!
@sgerodes
@sgerodes 3 жыл бұрын
The selector tool is magic
@Abdullahkbc
@Abdullahkbc 3 жыл бұрын
this extension is perfect. thank u so much.
@da_ta
@da_ta 4 жыл бұрын
very exceptional excellent work thanks for doing this
@167tejaswini
@167tejaswini 5 жыл бұрын
I have tried below ..but still not displaying here anything >>> response.css(".a-color-base.a-text-normal").extract() [] >>> response.css(".a-text-normal::text").extract() [] >>> response.css("a-text-normal").extract() []
@buildwithpython
@buildwithpython 5 жыл бұрын
Did you try it on the example website I gave?
@ReasonToKeepGoing
@ReasonToKeepGoing 5 жыл бұрын
Solved the issue in two different ways, response.css(".a-color-base.a-text-normal::text").getall() and response.css(".a-color-base.a-text-normal::text").extract()
@mihirthakur917
@mihirthakur917 5 жыл бұрын
Facing the same. Worked with quotes to scrape but not with amazon. I tried it with Flipkart and it worked
@buildwithpython
@buildwithpython 5 жыл бұрын
@@mihirthakur917 hey I have a separate video for Amazon in the same playlist
@CSSuccessGamer
@CSSuccessGamer 4 жыл бұрын
amazon must have found this video and decided to block scrapers...
@md.mahabuburrahman8544
@md.mahabuburrahman8544 3 жыл бұрын
Wow great tutorial
@anupamasingh1239
@anupamasingh1239 2 жыл бұрын
Hey, I'm getting error 404 while scraping the amazon website which you gave. I tied finding solution but was not able to fix it. Can you please help me out on this?
@alisiraydemir
@alisiraydemir 2 жыл бұрын
Just want to say Thank you!
@jamezz2181
@jamezz2181 4 жыл бұрын
how do you remove blank space like and spaces when it just has a bunch of them from it
@imaduddinsheikh3546
@imaduddinsheikh3546 3 жыл бұрын
Thank you so much for your Scrapy tutorials! However at 10:36, I tried running scrapy shell command on the Amazon website, and the response came back with a 503 code. How do I fix this? And, what's the issue behind it? I am running Windows 10.
@imaduddinsheikh3546
@imaduddinsheikh3546 3 жыл бұрын
Nevermind, I fixed the issue. I reduced the concurrent requests in the settings.py file to 1(I also added a user agent for Chrome browser with the latest version in the same file)
@ItsBen27
@ItsBen27 3 жыл бұрын
@@imaduddinsheikh3546 THANK YOU!!! Your comment saved me from a lifetime of searching for the fix!
@jiyarahman2673
@jiyarahman2673 4 жыл бұрын
Hi, I am following the code as you guide, but I am getting a Empty list for response.css even for previous video I got empty value can you explain me why?
@andrejohnv
@andrejohnv Жыл бұрын
Did you get it now? I'm getting empty list lol.
@naveenkumardongre
@naveenkumardongre Жыл бұрын
same I too getting empty list
@web_devs
@web_devs 4 жыл бұрын
Cant scrape amazon... returns empty list >>> response.css(".acs-product-block__product-title .a-truncate-cut::text").extract() [] any help..?
@yudhvirsingh9909
@yudhvirsingh9909 4 жыл бұрын
same here
@CSSuccessGamer
@CSSuccessGamer 4 жыл бұрын
i have same error,
@CSSuccessGamer
@CSSuccessGamer 4 жыл бұрын
did u find an alternate way?
@amitjamwal1985
@amitjamwal1985 5 жыл бұрын
Very helpful videos. thanks a lot :)
@amitkumar-yu6yz
@amitkumar-yu6yz 4 жыл бұрын
great video man.ver very thanku
@bhavyajain2034
@bhavyajain2034 4 жыл бұрын
will appreciate your help
@harshadmanglani1309
@harshadmanglani1309 5 жыл бұрын
The series is great, although there's something wrong with the quotestoscrape website, it gives me a twisted internet error, works for every other website though. Thanks.
@DarkScizor
@DarkScizor 4 жыл бұрын
Hi there, I had a question. I wanted to parse the alt text off of an img. How would I go about this? I appreciate any help you can give!
@pranaydas3320
@pranaydas3320 4 жыл бұрын
Use attrib("alt")
@redfeather22sa
@redfeather22sa 3 жыл бұрын
Your very Good !!!!
@ubaidmanzoorwani7491
@ubaidmanzoorwani7491 5 жыл бұрын
I am trying to scrap data from youtube but it is returning an empty list every time . please tell me what to do.
@gurjeetkaur3626
@gurjeetkaur3626 3 жыл бұрын
Helped a great....but after half of video .. view not clear
@souilahmaher7188
@souilahmaher7188 4 жыл бұрын
You're great instructor!
@buildwithpython
@buildwithpython 4 жыл бұрын
thanks
@emm5138
@emm5138 5 жыл бұрын
Great video! Thanks a lot!
@hasnainahmed6706
@hasnainahmed6706 4 ай бұрын
It is giving empty list on my pc at 11:12 please help me out.
@Imperialcodex1
@Imperialcodex1 Ай бұрын
Thanks man. 💪
@giotsas
@giotsas 5 жыл бұрын
Great video, just a small correction. In 09:00 you mention [1] is the first index of the list of authors. It's the second index.
@brendenandrews6965
@brendenandrews6965 4 жыл бұрын
How to access the previous commands in the shell.. usually when I'm in the terminal I am able to access the previous command using the up button but in the shell I am not able to do the same as shown in the video.. can anyone help me with this..
@ThallaSampathKumar
@ThallaSampathKumar Жыл бұрын
yes it is fine but it is not working for all websites returning me an empty list
@bhavyajain2034
@bhavyajain2034 4 жыл бұрын
SIR, while running scrapy shell command, terminal is raising a ValueError : invalid hostname: 'http
@TranLamYoutube
@TranLamYoutube Жыл бұрын
Amazon's source could change, I can't crawl data, elements are render from script, not from sample Html
@as-px2mv
@as-px2mv 3 жыл бұрын
thanks a lot!
@Jgs8115
@Jgs8115 5 жыл бұрын
Saved my neck thanks man
@jss2754
@jss2754 5 жыл бұрын
i have some question of this video. As you know ,scrapy is have a two ways for xpath that is css and xpath. i wonder why are u using css on your video .
@buildwithpython
@buildwithpython 5 жыл бұрын
In the next video I use xpath. I just like CSS selectors
@jss2754
@jss2754 5 жыл бұрын
@@buildwithpython thank u for comment!!
@Coney_island23
@Coney_island23 Жыл бұрын
great!
@shaikhanuman8012
@shaikhanuman8012 4 жыл бұрын
bro i am getting 503 error code how could i fix it please tell me brother
@teo-medesi
@teo-medesi 4 жыл бұрын
Go out back, find the biggest stick you can find, keep hitting your pc until it works. I hope this helped!
@shaikhanuman8012
@shaikhanuman8012 4 жыл бұрын
@@teo-medesi I tried brother due to that I bought new pc (😄 I fixed the error)
@shaikhanuman8012
@shaikhanuman8012 4 жыл бұрын
@@teo-medesithanks brother for providing valuable knowledge
@teo-medesi
@teo-medesi 4 жыл бұрын
@@shaikhanuman8012 Any time!
@shaikhanuman8012
@shaikhanuman8012 4 жыл бұрын
@@teo-medesi tq sir
@aakanshasingh9680
@aakanshasingh9680 4 жыл бұрын
scrapy crawl quotes. -> not returning anything. Nothing is displayed on the terminal
@aakanshasingh9680
@aakanshasingh9680 4 жыл бұрын
Basically, the function parse is not getting executed. Anything else written outside parse but inside the class is getting executed.
@jabiraziz1219
@jabiraziz1219 Жыл бұрын
Just Wowww
@CSSuccessGamer
@CSSuccessGamer 4 жыл бұрын
10:34 im getting 503 error from terminal for amazon
@CSSuccessGamer
@CSSuccessGamer 4 жыл бұрын
it says forbidden by robots, what do i do?
@aakashkhadka3835
@aakashkhadka3835 4 жыл бұрын
same here
@hau_hau_happu_singh
@hau_hau_happu_singh 4 жыл бұрын
I am continuously getting a null array, after using selector gadget.
@danielamorariu6722
@danielamorariu6722 4 жыл бұрын
you're probably getting a 503 error, which means service is unavailable. I solved this by specifying a user agent in settings.py and disabling the cookies, also in settings.py . User agent can be Mozzila 5.0 etc etc ( check explanations here: www.scrapehero.com/how-to-fake-and-rotate-user-agents-using-python-3/)
@Pandazaar
@Pandazaar 5 жыл бұрын
hey I was trying to follow along this video and I think you can no longer use response.css, because it was removed I guess, the error I get is: AttributeError: 'function' object has no attribute 'css'
@buildwithpython
@buildwithpython 5 жыл бұрын
Nope it's not removed. Don't think your scrap is installed properly.
@Pandazaar
@Pandazaar 5 жыл бұрын
@@buildwithpython oh, i did cd quotetutorial before opening shell,my bad
@babuji010
@babuji010 5 жыл бұрын
@@Pandazaar Hey, I am getting same error. Can you explain what went wrong? And solution pls. Thanks
@Pandazaar
@Pandazaar 5 жыл бұрын
@@babuji010 just type "cd .." and then open the shell
@anrm6
@anrm6 3 жыл бұрын
You are god
@doubled9645
@doubled9645 4 жыл бұрын
thx bro
@buildwithpython
@buildwithpython 4 жыл бұрын
No problem
@vigneshsivasubramanian9193
@vigneshsivasubramanian9193 4 жыл бұрын
is it only me or the entire headphones shakes and trembles when he presses his keys think they are feared of him please dont overuse it and give some rest for both u and your keyboard
@SquaredbyX
@SquaredbyX 4 жыл бұрын
Should be called a css De-selector
@Bihari_Chaman
@Bihari_Chaman 2 жыл бұрын
It is not a list its Array
@Yuri-xx2gi
@Yuri-xx2gi 2 жыл бұрын
It's a list, this is not C, in python they're called like that
@_thoneeer3220
@_thoneeer3220 4 жыл бұрын
wow
@juann9880
@juann9880 4 жыл бұрын
What if response =403, I can't extract anything?
Python Scrapy Tutorial - 10 - Extracting data w/ XPATH
9:12
buildwithpython
Рет қаралды 79 М.
What's in the clown's bag? #clown #angel #bunnypolice
00:19
超人夫妇
Рет қаралды 24 МЛН
Когда отец одевает ребёнка @JaySharon
00:16
История одного вокалиста
Рет қаралды 15 МЛН
Сюрприз для Златы на день рождения
00:10
Victoria Portfolio
Рет қаралды 2,4 МЛН
Fake watermelon by Secret Vlog
00:16
Secret Vlog
Рет қаралды 25 МЛН
Python Scrapy Tutorial - 11 - Web Scraping Quotes and Authors
9:48
buildwithpython
Рет қаралды 58 М.
You Should Use CSS Selectors for Web Scraping.
10:28
John Watson Rooney
Рет қаралды 16 М.
Intro To Web Crawlers & Scraping With Scrapy
28:56
Traversy Media
Рет қаралды 275 М.
CSS Selectors - Scrapy Tutorial Series Part#3
26:34
CodersLegacy
Рет қаралды 1,5 М.
Using CSS custom properties like this is a waste
16:12
Kevin Powell
Рет қаралды 175 М.
Following LINKS Automatically with Scrapy CrawlSpider
14:33
John Watson Rooney
Рет қаралды 33 М.
Always Check for the Hidden API when Web Scraping
11:50
John Watson Rooney
Рет қаралды 638 М.
This is How I Scrape 99% of Sites
18:27
John Watson Rooney
Рет қаралды 129 М.
These CSS PRO Tips & Tricks Will Blow Your Mind!
8:48
Coding2GO
Рет қаралды 420 М.
What's in the clown's bag? #clown #angel #bunnypolice
00:19
超人夫妇
Рет қаралды 24 МЛН