Home > other >  Xpath value problem, the great god I just want to take area what to take, please?
Xpath value problem, the great god I just want to take area what to take, please?

Time:10-10

CodePudding user response:

Xpath as can operation to here, the follow-up with a list of some operate the extraction of the characters

CodePudding user response:

Trouble site posted

CodePudding user response:

Climb the url
https://jn.lianjia.com/zufang/

CodePudding user response:

The
refer to the third floor of green tea, reply:
crawl the site
https://jn.lianjia.com/zufang/

To give you an example of the xpath
 the from simplified_scrapy. Simplified_doc import SimplifiedDoc 
The from simplified_scrapy. Request the import the req

HTML=the req. Get (' https://jn.lianjia.com/zufang/')
Doc=SimplifiedDoc ()
Divs=doc. GetElementsByClass (' content__list - item - the main, HTML)
LST=[]
For div divs in:
The item={}
Ps=doc. GetChildren (div. InnerHtml)
The item [' title ']=ps [0]. Text
Item/' mianji=ps [1]. The text. The split ('/') [1]
Item [' brand ']=ps [2]. The text
Item [' time ']=ps [3]. The text
Item [' other ']=ps [4]. The text
If len (ps) & gt; 5:
Item [' price ']=ps [5]. The text
LST. Append (item)
Print (item)
  • Related