问题描述
您好,我想从表格中抓取数据.我需要全天的所有天气信息
Hi I want to scrap the data from the table. I need all the weather information for all days
请检查此链接 https://www.accuweather.com/en/in/bengaluru/204108/month/204108?view = table
源代码:
<tbody>
<tr class="pre">
<th scope="row">Tue <time>5/1</time></th>
<td>91°/71°</td>
<td>0 <span class="small">in</span></td>
<td>0 <span class="small">in</span></td>
<td> </td>
<td>93°/71°</td>
</tr>
<tr class="pre">
<th scope="row">Wed <time>5/2</time></th>
<td>91°/75°</td>
<td>0.03 <span class="small">in</span></td>
<td>N/A <span class="small">in</span></td>
<td> </td>
<td>93°/71°</td>
</tr>
<tr class="today lo calendar-list-cl-tr cl hv" data-href="https://www.accuweather.com/en/in/bengaluru/204108/daily-weather-forecast/204108?day=1">
<th scope="row"><a href="https://www.accuweather.com/en/in/bengaluru/204108/daily-weather-forecast/204108?day=1">Thu <time>5/3</time></a></th>
<td>93°/72°</td>
<td>0.04 <span class="small">in</td>
<td>0 <span class="small">in</span></td>
<td>
<div class="icon i-17-s"></div>
<p>A thunderstorm in spots</p>
</td>
<td>93°/71°</td>
</tr>
</tbody>
推荐答案
这并不能真正直接回答您的问题,但可能是最接近您的情况,而不会在问题中添加更多信息并表明您正在通过在问题中包含一些代码来自行解决此问题.或者,也许 更适合您:
This doesn't really directly answer your question but may be the closest you'll get without adding more information to your question and showing that you're making an effort to solve this on your own, by including some code in your question. Or maybe this will work better for you:
为什么要抓取一个愿意以一种易于处理的格式免费免费提供给您的数据的网站?
Why scrape a site that is willing to practically "hand you" the data, in an easier to handle format, for free?
Accuweather(像许多网站一样)具有可供家庭使用的免费API(每天最多可免费拨打50个电话) 这是一个链接 .
Accuweather (like many sites) has an API which is free for home use (free up to 50 calls per day) Here is a link.
但是(作为一个庞大的天气和数据极客),我非常更喜欢 DarkSky Weather API ,它最多允许 1000免费拨打一天,并且(取决于您对查询感兴趣的位置 )是我所见过的最准确的一天. (H从自己的来源获取数据以及他们可以动手使用的所有其他东西( 这是一个链接. )
However (as a big weather & data geek) I much prefer DarkSky Weather API, which allows up to 1000 calls a day for free and (depending on where you're interested in querying) is the most accurate I've seen. (H The get the data from their own sources combined with everything else they can get their hands on (Here is a link.)
我有一个Access数据库,在过去一年多的时间里,蜜蜂每8小时自动打开一次(使用Windows Task Scheduler),并查询未来10天和过去3天的详细天气,以查找天气趋势和最终可以很好地预测我的家庭取暖费用.
I have an Access DB that, for over a year now, has bee automatically opening itself every 8 hours (with Windows Task Scheduler) and querying detailed weather 10 days into the future and 3 days into the past, seeking weather trends and ultimately doing a pretty good job of predicting my home heating costs.
在美国(我不是),他们甚至声称最精确的预测是平方码,直到分钟.
In the USA (where I am not) they even claim the most accurate forecasts down the square-yard, down to the minute.
此外,DarkSky是唯一带有可选的 Emoji气象图的人.不太有用,但总能带来笑声.大声笑
Plus, DarkSky is the only one with an optional Emoji Weather Map. Not very useful but always good for a chuckle. lol
只是为了好玩,明天这里是您所在的地区...在那儿中间分开吗? (他们也有 real 数据.)
Just for fun, here's your area tomorrow... split down the middle there eh? (They do have real data too.)
无论如何,值得一试-但正如@Peh指出的那样,您不能指望为您完成所有工作.
Anyway it's worth checking out - but as @Peh indicated, you can't expect all the work to be done for you.
这篇关于从AccuWeather网站上抓取表格数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!