我尝试使用BeautifulSoup从TD标记和python2.7中的请求之间提取文本。到目前为止,使用这个代码我什么也没有得到:(
import requests
from bs4 import BeautifulSoup
# Set up the Spider
def card_search(max_pages):
page = 1
mtgset = 'portal'
card = 'lava-axe'
while page <= max_pages:
url = 'http://www.mtgotraders.com/store/search-results.html?q=lava+axe&x=0&y=0'
source_code = requests.get(url)
plain_text = source_code.text
soup = BeautifulSoup(plain_text)
for text in soup.findAll('td',{'class': 'price mod'}):
pagetext = text.get('td')
print(pagetext)
page += 1
card_search(1)
我正在尝试自动排序并对MTG卡集合进行赋值,因此代码示例中使用的站点的结果非常重要。我知道这个网站可以被解析,因为我让它返回链接。可悲的是,我不能让纯文本发生。在
这里是用于拉链接的代码,但它不是针对表的。只有页面本身。在
^{pr2}$谨致问候, 酸千斤顶
如果你想让你的刮削有更大的灵活性,你需要一些类似幻影的东西。看看派克勒的安沃斯here。在
相关问题 更多 >
编程相关推荐