Is there a way to extract text along with text-links in Scrapy using CSS?

后端 未结 2 381
长发绾君心
长发绾君心 2021-01-28 17:28

I\'m brand new to Scrapy. I have learned how to use response.css() for reading specific aspects from a web page, and am avoiding learning the xpath system. It seems

2条回答
  •  清歌不尽
    2021-01-28 18:17

    Use html-text after extracting the whole paragraph:

    from html_text import extract_text
    
    for paragraph in response.css('p'):
        html = paragraph.get()
        text = extract_text(html)
    

提交回复
热议问题