2016-04-09 14 views
-1

Ich brauche getrennt erhält die Liste der Verletzungen aus der folgenden Markup zu erhalten:Wie man Text von br-Elementen in Scrapy

<b><font size="2" face="Verdana">Violations:</font></b><br> 
<i><font size="2" face="Verdana">A summary of the violations found during the inspection are listed below.</font></i><br> 
<br> 
<font size="2" face="Verdana">209 Food not protected from contamination [s. 12(a)] <br> 
<br> 
302 *Critical* Equipment/utensils/food contact surfaces not properly washed and sanitized [s. 17(2)] <br> 
<br> 
306 Food premises not maintained in a sanitary condition [s. 17(1)] <br> 
<br> 
</font><br> 

Jede Idee, wie ich das erreichen könnte?

Antwort

0

Verwendung so etwas wie dieses

response.xpath('string(//font)').extract() 

UPD: Verwenden Selektor response.xpath("string(//font[5])").extract() Wenn Sie diese Seite analysieren http://www.healthspace.ca/Clients/FHA/FHA_Website.nsf/0/ABD0FA785D27B11588257C6900050EA3?OpenDocument

+0

Das bin ich alle Schriftelemente im Dokument gibt. Ich habe '// font [text() = "Violations:"]/following :: font' versucht, aber das funktioniert auch nicht. – MoreScratch

+0

Kannst du mir Webseite URL? –

+0

Ich aktualisierte die Antwort, überprüfe es noch einmal –