Examples for Name --> response.xpath(u'//div[@id="cContentPlaceHolder1"]//h1/text()') Kind --> u'//span[contains(.,"Tipo de centro" )]/font/text()' Web --> u'//div[@id="cContentPlaceHolder1"]//a[@class="enlace_web"]/@href' Address --> u'//div[@id="cContentPlaceHolder1"]/div[1]/span[3]'
You can use element inspector or firebug or other tool that can help you with xpath expressions [1]. Does it help you? [1] http://doc.scrapy.org/en/latest/topics/firefox.html -- luismiguel (@lmorillas) 2015-01-06 20:04 GMT+01:00 ROBERTO ANGUITA MARTIN <[email protected]>: > Hola Luis Miguel, pero solo necesito resolver una duda para poder partir, > como puedo posicionar, seleccionar con Xpath si solo tengo etiquetas HTML > sin identificarse por id o class? > > > El lunes, 5 de enero de 2015 00:56:37 UTC+1, Luis Miguel Morillas escribió: >> >> Yes, it is. Think on the xpath expressions to ecxtract the data. >> >> El 4/1/2015 23:55, "ROBERTO ANGUITA MARTIN" <[email protected]> >> escribió: >>> >>> Nobody can say me if is posible? >>> >>> El lunes, 22 de diciembre de 2014 15:44:11 UTC+1, ROBERTO ANGUITA MARTIN >>> escribió: >>>> >>>> Hi i want try create a spider for a directory with this format >>>> Fields: >>>> - Name >>>> - Kind >>>> - Web >>>> - Adrress >>>> - Location >>>> - Telephone >>>> >>>> But every fields haven't any id or class: >>>> This is a real example: >>>> >>>> <div id="cContentPlaceHolder1" class="encontrados"> >>>> <div class='float_left' style='width:265px; >>>> text-align:center'> >>>> <h1>Colegio Els Cingles</h1></span> >>>> <span class="txt_nor">Tipo de centro : <font >>>> style="color:#22B1AF">Público</font></span> >>>> <div class="separador_horizontal_5"></div><span class="txt_nor">Web >>>> :</span> >>>> <a class="enlace_web" style="font-size:13px;" title="Visitar" >>>> target="_blank" href=http://www.xtec.cat/ceipelscingles/ alt="Ir a la >>>> Web/Blog del colegio Colegio Els Cingles" title="Ir a la Werb/Blog del >>>> colegio Colegio Els Cingles">Visitar Web/Blog</a> >>>> <span class="txt_nor">Calle Camí De La Violona, s/n - Cp: 08480</span> >>>> <div class="separador_horizontal_3"></div><span class="txt_nor">AMETLLA >>>> DEL VALLES (L') (BARCELONA)</span></div> >>>> <div class="separador_horizontal_5"></div><span >>>> class="txt_nor">938457039 - 938432081</span></div> >>>> .... >>>> </div> >>>> </div> >>>> >>>> How can do some rule extraction for can capture name and Adrress? >>>> >>>> >>>> its posible?? >>>> >>>> Kind Regards >>>> Roberto >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "scrapy-users" group. >>> To unsubscribe from this group and stop receiving emails from it, send an >>> email to [email protected]. >>> To post to this group, send email to [email protected]. >>> Visit this group at http://groups.google.com/group/scrapy-users. >>> For more options, visit https://groups.google.com/d/optout. > > -- > You received this message because you are subscribed to the Google Groups > "scrapy-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/scrapy-users. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "scrapy-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/scrapy-users. For more options, visit https://groups.google.com/d/optout.
