vbs- rem On Error Resume Next
-
- Dim http, html, strOut, i, dt, ymd, url
- Set http = CreateObject("Msxml2.XMLHTTP")
- Set html = CreateObject("htmlfile")
- strOut = ""
-
- For i = 0 To 9
- dt = DateAdd("d", -i, date)
- ymd = Year(dt) & "-" & Right(Month(dt) + 100, 2) & "-" & Right(Day(dt) + 100, 2)
- url = "http://open.iciba.com/dsapi/?date=" & ymd
- http.open "GET", url, False
- http.send
- strOut = GetJSON(http.responseText) & vbCrLf & vbCrLf & strOut
- Next
-
- Function GetJSON(txt)
- Dim window, json
- Set window = html.parentWindow
- window.execScript "var json = " & txt, "JScript"
- Set json = window.json
- GetJSON = json.content & vbCrLf & json.note & vbCrLf
- GetJSON = GetJSON & json.translation & vbCrLf & json.dateline
- End Function
-
- Dim fso
- Set fso = CreateObject("Scripting.FileSystemObject")
- fso.CreateTextFile("ciba.Log", 2, True).Write(strOut)
-
- MsgBox "Done"
复制代码 PowerShell v3.0- -9..0 | ForEach{$url = 'http://open.iciba.com/dsapi/?date=' + (get-Date).AddDays($_).ToString('yyyy-MM-dd'); (Invoke-WebRequest $url).Content | ConvertFrom-Json | ForEach{$_.content; $_.note; $_.translation; $_.dateline}}
复制代码
|