我想编辑一些使用重新编译要将数据丢弃到BeautifulSoup4
中,原始代码如下所示
import urllib, urllib2, re, sys, xbmcplugin, xbmcgui
link = read_url(url)
match = re.compile('<a class="frame[^"]*"'
' href="(http://somelink.com/section/[^"]+)" '
'title="([^"]+)">.*?<img src="([^"]+)".+?Length:([^<]+)',
re.DOTALL).findall(link)
for url, name, thumbnail, length in match:
addDownLink(name + length, url, 2, thumbnail)
以及html
^{pr2}$现在如何使用BeautifulSoup4
获得url
(href)和name
和{addDownLink(name + length, url, 2, thumbnail)
这给了你:
^{pr2}$如果您有多个部分,我们只需要查找所有并将逻辑应用到每个部分:
如果您不知道所有的类,但您知道例如有一个img标记,您可以在该部分调用find:
同样的逻辑也适用于其他人。在
相关问题 更多 >
编程相关推荐