这是一个创建于 1289 天前的主题,其中的信息可能已经有所发展或是发生改变。
最近写了个脚本抓电视节目自用,遇到了个小问题,请教下,对于一个标签内,我怎么判断 a 标签的内容是在前还是后啊?
如下情况,第一种 a 标签在后面呢,第二种情况,a 标签的内容就在前面,我目前是获取./span/text() + ./span/a/@href ,有些就是反的....
<span class="p_show">海豚万家剧场:<a title="康熙王朝剧情介绍 " href="/drama/MnJXVQ==">康熙王朝</a></span>
<span class="p_show"><a title="宇宙护卫队剧情介绍 " href="/drama/JFxhX2Nv">宇宙护卫队</a>2:爱探险的小梅花鹿</span>
|
|
1
tia 2021-03-27 14:31:02 +08:00
试试 beautifulsoup
|
|
|
2
coolloves 2021-03-27 14:44:10 +08:00 via Android
和 lxml 原理不一样吗? bs 怎么判断前后呢?请教
|