Alışılmışın Dışında XPath

Python ile Web Scraping

Thomas Laetsch

Data Scientist, NYU

(At)tribute

  • @ "öznitelik"i temsil eder
    • @class
    • @id
    • @href
Python ile Web Scraping

Köşeli Parantezler ve Öznitelikler

xpathattr.png

Python ile Web Scraping

Köşeli Parantezler ve Öznitelikler

xpathattr_div_p1.png

xpath = '//p[@class="class-1"]'
Python ile Web Scraping

Köşeli Parantezler ve Öznitelikler

xpathattr_div.png

xpath = '//*[@id="uid"]'
Python ile Web Scraping

Köşeli Parantezler ve Öznitelikler

xpathattr_div_astc2.png

xpath = '//div[@id="uid"]/p[2]'
Python ile Web Scraping

Contains ile İçerik

Xpath contains gösterimi:

contains( @öznitelik-adı, "dize-ifadesi" )

Python ile Web Scraping

Bunu Contains Yapın

xpath = '//*[contains(@class,"class-1")]'

ClassSelection-Xpath-contains.png

Python ile Web Scraping

Bunu Contains Yapın

xpath = '//*[@class="class-1"]'

ClassSelection-Xpath-eq.png

Python ile Web Scraping

Sınıfı Alın

xpathattr_div_astc2.png

xpath = '/html/body/div/p[2]'
Python ile Web Scraping

Sınıfı Alın

xpathattr_div_p2-class.png

xpath = '/html/body/div/p[2]/@class'
Python ile Web Scraping

Yolun Sonu

Python ile Web Scraping

Preparing Video For Download...