Use Lua to extract info from webpage
Posted: April 19th, 2019, 12:06 pm
hi, I have a rainmeter skin that uses RegExp to get info from a website. How can I load the page once and then extract multiple info from it using lua?
the website is below
https://www.spaceflightinsider.com/launch-schedule/
From this page, I interested in "Next Launch" data
Some of the info I'm interested in;
Mission: CRS-17
Vehicle: Falcon 9 v1.2
Time: 26 Apr 05:55:00 EDT
For that, I'm currently using multiple RegExp (loads page many times) but I think we can Lua to load the page once then extract info from that as many times as we want.
Can someone please provide an example?
the website is below
https://www.spaceflightinsider.com/launch-schedule/
From this page, I interested in "Next Launch" data
Code: Select all
<span>Next Launch: <a href="https://www.spaceflightinsider.com/launch-schedule#launch-374">CRS-17</a></span>
</div>
<div class="cd_info">
<table>
<tr>
<th>Mission</th>
<td class="mission"><a href="https://www.spaceflightinsider.com/launch-schedule#launch-374">CRS-17</a></td>
</tr><tr>
<th>Vehicle</th>
<td class="vehicle">Falcon 9 v1.2</td>
</tr>
<noscript>
<tr>
<th>Time</th>
<td>26 Apr 05:55:00 EDT</td>
</tr>
Mission: CRS-17
Vehicle: Falcon 9 v1.2
Time: 26 Apr 05:55:00 EDT
For that, I'm currently using multiple RegExp (loads page many times) but I think we can Lua to load the page once then extract info from that as many times as we want.
Can someone please provide an example?