好吧#include <INet.au3>
#include <Date.au3>
Local $bSource = _INetGetSource('http://www.baidu.com/s?tn=80035161_2_dg&wd=%E8%8A%82%E5%81%87%E6%97%A5', 0)
Local $sSource = BinaryToString($bSource, 4)
Local $aTmp = StringRegExp($sSource, '<th>节日</th>[\s\S]+?</table>', 1)
If @error Then Exit MsgBox(48, '', '获取网页源错误')
Local $aOk = StringRegExp($aTmp[0], '<tr>\s+<td>(.+?)</.+?\s+<td>(.+?)</[\s\S]+?\s+<td>共(\d+)天</', 3)
Local $sOut = '', $i, $j
For $i = 0 To UBound($aOk) - 1 Step 3
$sOut &= StringLeft($aOk[$i], 2) & ':' & _CreatDateStr($aOk[$i + 1], $aOk[$i + 2]) & @CRLF
Next
MsgBox(0, @YEAR & ' 年节假日安排', $sOut)
Func _CreatDateStr($sData, $vDay)
Local $aTmp = StringRegExp($sData, '^(\d+)月(\d+)日', 1)
If @Error Then Return SetError(1, 0, '')
Local $sD = StringFormat('%04s/%02s/%02s', @YEAR, $aTmp[0], $aTmp[1])
Local $sOut = $sD & ' ', $i, $sBak = $sD
For $i = 2 To $vDay
$sBak = _DateAdd('d', 1, $sBak)
$sOut &= $sBak & ' '
Next
Return $sOut
EndFunc ;==>_CreatDateStr
|