I plan to use the Scrapy framework to crawl the data of a website on the JS console. I use $ x (& #039; div [@ class & quot; summary & quot;] div [contains (@ class, & quot; tags & quot;)] & #039;) This command obtains the data I want, but I have to filter my data. Is my JS console in the browser...
I plan to useScrapy
The framework crawls the data of a website.
InJS
Console, I use$ X ('// p [@ class = "summary"] // p [contains (@ class, "tags")]')
This command gets the data I want, but I have to filter my data.
It's in my browser.JS
Console output result
I want to useXpath
Continue filtering. filter the data in the green box. How can I write it?Xpath
Statement?
Reply content:
I plan to useScrapy
The framework crawls the data of a website.
InJS
Console, I use$ X ('// p [@ class = "summary"] // p [contains (@ class, "tags")]')
This command gets the data I want, but I have to filter my data.
It's in my browser.JS
Console output result
I want to useXpath
Continue filtering. filter the data in the green box. How can I write it?Xpath
Statement?
$ X ('// p [@ class = "summary"] // p [contains (@ class, "tags")]/a // text ()')
Not tested
Use a/text () to obtain