Python ile Web Scraping
Thomas Laetsch
Data Scientist, NYU
Selector vs Response:
xpath ve css metodları, ardından extract ve extract_first metodları.xpath metodu Selector gibi çalışırresponse.xpath( '//div/span[@class="bio"]' )
css metodu Selector gibi çalışırresponse.css( 'div > span.bio' )
response.xpath('//div').css('span.bio')
response.xpath('//div').css('span.bio').extract()
response.xpath('//div').css('span.bio').extract_first()
response, URL’yi response.url değişkeninde tutar.response.url
>>> 'http://www.DataCamp.com/courses/all'
response, follow() metodu ile yeni bir bağlantıyı "takip etmemizi" sağlar# next_url, kazımak istediğimiz bir sonraki URL’nin dizge yoludur
response.follow( next_url )
follow hakkında daha sonra daha fazlasını öğreneceğiz.Python ile Web Scraping