<div class="a">
<div class="b">
</div>
<div class="d">
</div>
</div>
<div class="a">
<div class="b">
</div>
<div class="d">
</div>
</div>
suppose the data are as follows:
<div class="a">
<div class="b">
text1
</div>
<div class="d">
text2
</div>
</div>
get it through the following xpath:
div[1]//div[contains(text(),"text1")]/following-sibling::node()[position() <= count( div[1]//div[contains(text(),"text2")]/following-sibling::node()) + 1]
try
Previous: WeChat Mini Programs failed to log in
Next: Configure zookeeper cluster in storm.yaml, port problem of zookeeper
crawls the movie of Douban, saying that the tag of each movie is parsed into list, but after traversing the list, it is found that every element in the list is the same . movies = selector.xpath( *[@id="content"] div div[1] ol li ) -sharp...
A nasty piece of html code that writes js in div. It s a keyboard paging code xpath found that the tagged content in is gone, like this I am China person what I get is: I am human. China does not have , and then some people say that my xpath ...
I already know that the way to write a specified class is: * [@ class= class ] and I already know that the way to choose the first one is: div [n] what should be the combination of the two? For example, select the last element of class= cla...
The link to the picture crawled by xpath is a relative link: div [@ class= thumb ] a picturehref. The result is 19.jpg how to get an absolute link, similar to http: www.example.com 19.jpg. is there any good way? thank you very much! ...
as shown in the following figure, can I use xpath to get the SCR value of the attribute? (or do you want to get the node first and then come out in another way?) div[@id="indexCarousel"] div[@class="item"] img[@src] ...
want to crawl http: 47.99.86.238 portal li. the data of this website, use scrapy, to set everything else, only one value to get is None, please take a look at it. I can match the value using the plug-in myself, but the result printed by storyMale in...
The code is a little messy, but that s what the original page looks like. You can change it . <li class="list__item"><div class="list__title">The world this week< div><a itemProp="url" class="link...
<div class="container"> <div class="col-12 col-sm-3"> <p class="title"> 001 < div> <div class="col-12 col-sm-3"> <p class="title"> 999 < div&...
problem description in the process of learning Scrapy, use xpath to extract the desired content. First, extract the li tag in the ul tag to get the list, traversal list content with all the li tags, and then xpath extract the desired information from ...
<table> <thead><tr>< tr>< thead> <tbody> <tr class="aaa">< tr> <tr>< tr> <tr class="aaa">< tr> <tr>< tr> <tr>< tr> <tr cla...