WechatSogou
WechatSogou copied to clipboard
get_gzh_by_search() 中解析 authentication 时会出现非预期的结果
按照之前的写法,现在该字段获取到的都是 "\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]')