Python 使用css选择器在抓取中提取跨度外的文本

Python 使用css选择器在抓取中提取跨度外的文本,python,html,scrapy,css-selectors,scrapy-spider,Python,Html,Scrapy,Css Selectors,Scrapy Spider,我有以下html代码: <h1> <a href="https://www.google.com"> <span>448587: </span>Brian McMills </a> </h1> 我只对布莱恩·麦克米尔斯感兴趣。我想使用scrapycss选择器功能来选择文本 当我使用h1a::text时,它只选择448587:部分,我尝试了:not(

我有以下html代码:

    <h1>
        <a href="https://www.google.com">
            <span>448587: </span>Brian McMills
        </a>
    </h1>

我只对布莱恩·麦克米尔斯感兴趣。我想使用scrapy
css选择器
功能来选择文本

当我使用
h1a::text
时,它只选择
448587:
部分,我尝试了
:not(span)
的一些组合,但它不起作用


注意:我对
Xpath
scripting
解决方案不感兴趣,只有
css
唯一有效的方法是
h1a:not(span)::text

谢谢。

试着看看这里
h1a:不(span)
必须工作。你试过用这种方式写吗?我必须添加
h1a:not(span)::text
才能使它工作。谢谢