chyroc / WechatSogou

基于搜狗微信搜索的微信公众号爬虫接口

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

get_gzh_by_search() 中解析 authentication 时会出现非预期的结果

wangyuxinwhy opened this issue · comments

按照之前的写法,现在该字段获取到的都是 "\n"。实际上是有值的。

通过 xpath 获取到的结果为 ["\n", "some value about authentication "],但我们只去了index = 0 这一项,所以会造成非预期的结果。

建议修改成下方的写法,更加健壮一些。最好在该字段提取时,还是不要使用 get_first_of_element api 太死板。

authentication = get_first_of_element(li, './/i[@Class="identify"]/parent::dd/text()[2]')