我得把这些数据作废
这是我想从link中获取的网站。我能够获得td数据,但我需要从一个特定的td标签开始(即从这个tr标签开始)
<tr style="height:14px"></tr>
<tr class='athing' id='20463814'>
<td align="right" valign="top" class="title"><span class="rank"></span></td> <td></td><td class="title"><a href="https://mino-games.workable.com/j/69BCF95C8F" class="storylink" rel="nofollow">Mino Games (YC W11) Is Hiring Game Developers in Montreal</a><span class="sitebit comhead"> (<a href="from?site=workable.com"><span class="sitestr">workable.com</span></a>)</span></td></tr><tr><td colspan="2"></td><td class="subtext">
<span class="age"><a href="item?id=20463814">11 hours ago</a></span> </td></tr>
然后继续向其他标签移动,同时在一个单独的变量中不断获取公司名称、位置和位置的数据。我知道这是一个很大的要求,但我会感谢你能提供任何帮助。你知道吗
这就是我所尝试的:
import requests
from bs4 import BeautifulSoup
url = 'https://news.ycombinator.com/jobs'
plain_html_text = requests.get(url);
soup = BeautifulSoup(plain_html_text.text, "html.parser")
table_body = soup.find('tbody')
rows = soup.find('tr')
for row in rows:
cols = row.find_all('td')
cols = [x.text.strip() for x in cols]
print (cols)
你想要的不是一个简单的问题,但是这个脚本可以让你开始:
印刷品:
这是一个基本的刮刀,将标题分为公司和职位。你知道吗
输出:
相关问题 更多 >
编程相关推荐