anonymous No title
No License VisualBasic
2020年08月01日
Copy Clone
Option Explicit
Dim objHTTP As Object
Dim md As Date
Const err404$ = "error 404"

Sub OnsenStreamsListing()
  Dim json$, l&, c$, s$, p%, r%, a$(), b$(), i%
  Cells.ClearContents
  Set objHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")

  json = DownloadTextFromURL("https://www.onsen.ag/web_api/programs")
  For l = 1 To Len(json)
    c = Mid(json, l, 1)
    s = s & c
    Select Case c
      Case "{": p = p + 1
      Case "}": p = p - 1
                If p = 0 Then
                  r = r + 1
                  a = Split(s, ",""")
                  For i = UBound(a) To 0 Step -1
                    b = Split(a(i), """")
                    If UBound(b) >= 2 Then
                      Select Case b(0)
                        Case "title":
                            Cells(r, 1) = b(2)
                        Case "updated":
                            Cells(r, 2) = b(2)
                        Case "delivery_interval":
                            Cells(r, 3) = b(2)
                        Case "streaming_url":
                            Cells(r, 4) = b(2)
                            s = Split(b(2), "/")(6)
                            Cells(r, 5) = Split(b(2), "/")(5)
                            Cells(r, 6) = DetectStreamFile(s)
                            If Cells(r, 6) <> err404 Then Cells(r, 7) = Format(md, "'yyyy/mm/dd hh:mm:ss")
                      End Select
                    End If
                  Next
                  s = ""
                End If
    End Select
  Next

  Call Sort1
  MsgBox ("    Done.")
End Sub

Function DownloadTextFromURL$(url$)
  objHTTP.Open "GET", url, False
  objHTTP.Send
  DownloadTextFromURL = objHTTP.ResponseText
End Function

Function DetectStreamFile$(fname$)
  Dim a$(), x$, y$, b$(5), i%, j%, s$, t$
  a = Split(fname, "-")
  ReDim Preserve a(UBound(a) - 1)
  s = Join(a, "-")
  x = Left(s, Len(s) - 4)
  y = UCase(Right(s, 4))
  For i = 1 To 4
    b(i) = Mid(y, i, 1)
  Next
  For i = 1 To 4
    b(i) = LCase(b(i))
    s = x & b(1) & b(2) & b(3) & b(4) & ".mp"
    For j = 3 To 4
      t = s & j
      If httpStatus("https://onsen-dl.sslcs.cdngc.net/radio/" & t) = 200 Then
        DetectStreamFile = t
        Exit Function
      End If
    Next
    b(i) = UCase(b(i))
  Next
  DetectStreamFile = err404
End Function

Function httpStatus%(url$)
  Dim s$, a$(), n%, t As Date
  objHTTP.Open "HEAD", url, False
  On Error Resume Next
  objHTTP.Send
  n = Val(objHTTP.Status)
  httpStatus = n
  
  If n = 200 Then
    s = Split(objHTTP.GetAllResponseHeaders, "Last-Modified: ")(1)
    a = Split(s, " ")
    t = TimeValue(a(4)) + TimeValue("9:00:00")
    a(0) = ""
    ReDim Preserve a(3)
    md = DateValue(Join(a, " ")) + t
  End If
  On Error GoTo 0
End Function

Sub Sort1()
  With ActiveWorkbook.ActiveSheet.Sort
    .SortFields.Clear
    .SetRange Range("A:G")
    .SortFields.Add2 Key:=Range("E:E"), Order:=xlDescending
    .SortFields.Add2 Key:=Range("B:B"), Order:=xlDescending
    .Apply
  End With
End Sub
Option Explicit
Dim objHTTP As Object
Dim md As Date
Const err404$ = "error 404"

Sub OnsenStreamsListing()
  Dim json$, l&, c$, s$, p%, r%, a$(), b$(), i%
  Cells.ClearContents
  Set objHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")

  json = DownloadTextFromURL("https://www.onsen.ag/web_api/programs")
  For l = 1 To Len(json)
    c = Mid(json, l, 1)
    s = s & c
    Select Case c
      Case "{": p = p + 1
      Case "}": p = p - 1
                If p = 0 Then
                  r = r + 1
                  a = Split(s, ",""")
                  For i = UBound(a) To 0 Step -1
                    b = Split(a(i), """")
                    If UBound(b) >= 2 Then
                      Select Case b(0)
                        Case "title":
                            Cells(r, 1) = b(2)
                        Case "updated":
                            Cells(r, 2) = b(2)
                        Case "delivery_interval":
                            Cells(r, 3) = b(2)
                        Case "streaming_url":
                            Cells(r, 4) = b(2)
                            s = Split(b(2), "/")(6)
                            Cells(r, 5) = Split(b(2), "/")(5)
                            Cells(r, 6) = DetectStreamFile(s)
                            If Cells(r, 6) <> err404 Then Cells(r, 7) = Format(md, "'yyyy/mm/dd hh:mm:ss")
                      End Select
                    End If
                  Next
                  s = ""
                End If
    End Select
  Next

  Call Sort1
  MsgBox ("    Done.")
End Sub

Function DownloadTextFromURL$(url$)
  objHTTP.Open "GET", url, False
  objHTTP.Send
  DownloadTextFromURL = objHTTP.ResponseText
End Function

Function DetectStreamFile$(fname$)
  Dim a$(), x$, y$, b$(5), i%, j%, s$, t$
  a = Split(fname, "-")
  ReDim Preserve a(UBound(a) - 1)
  s = Join(a, "-")
  x = Left(s, Len(s) - 4)
  y = UCase(Right(s, 4))
  For i = 1 To 4
    b(i) = Mid(y, i, 1)
  Next
  For i = 1 To 4
    b(i) = LCase(b(i))
    s = x & b(1) & b(2) & b(3) & b(4) & ".mp"
    For j = 3 To 4
      t = s & j
      If httpStatus("https://onsen-dl.sslcs.cdngc.net/radio/" & t) = 200 Then
        DetectStreamFile = t
        Exit Function
      End If
    Next
    b(i) = UCase(b(i))
  Next
  DetectStreamFile = err404
End Function

Function httpStatus%(url$)
  Dim s$, a$(), n%, t As Date
  objHTTP.Open "HEAD", url, False
  On Error Resume Next
  objHTTP.Send
  n = Val(objHTTP.Status)
  httpStatus = n
  
  If n = 200 Then
    s = Split(objHTTP.GetAllResponseHeaders, "Last-Modified: ")(1)
    a = Split(s, " ")
    t = TimeValue(a(4)) + TimeValue("9:00:00")
    a(0) = ""
    ReDim Preserve a(3)
    md = DateValue(Join(a, " ")) + t
  End If
  On Error GoTo 0
End Function

Sub Sort1()
  With ActiveWorkbook.ActiveSheet.Sort
    .SortFields.Clear
    .SetRange Range("A:G")
    .SortFields.Add2 Key:=Range("E:E"), Order:=xlDescending
    .SortFields.Add2 Key:=Range("B:B"), Order:=xlDescending
    .Apply
  End With
End Sub
anonymous
Anonymous
2021年04月22日
Medication information. Drug Class. <a href="https://lyrica24x7.top">where to buy generic pregabalin without a prescription</a> in USA Actual about medicament. Read now.
anonymous
Anonymous
2021年04月24日
Meds information sheet. What side effects can this medication cause? <a href="https://pregabalinfor.top">buying cheap pregabalin pills</a> in the USA Actual what you want to know about drugs. Read information now.
anonymous
Anonymous
2021年04月30日
viagra vs cialis reddit <a href="https://mycialistabs.com/">cialis 10mg</a> cialis free 30 day trial
anonymous
Anonymous
2021年04月30日
cialis ingredients <a href="https://mycialistabs.com/">generic cialis</a> cialis review
anonymous
Anonymous
2021年05月01日
generic cialis reviews <a href="https://toptadalafiltabs.com/">how cialis works</a> cialis daily dosage
anonymous
Anonymous
2021年05月02日
cialis side effects <a href="https://toptadalafiltabs.com/">how long does cialis take to kick in</a> natural cialis
anonymous
Anonymous
2021年05月04日
how to write a good essay question <a href="https://topessaywriterfas.com/">college essay art</a> how to write a law essay plan
anonymous
Anonymous
2021年05月04日
write a college essay <a href="https://topessaywriterfas.com/">pay for college essay</a> how to write a good ap essay
anonymous
Anonymous
2021年05月05日
custrom essay writing service <a href="http://writemyessayslfd.com/">legitimate essay writing service</a> comparative essay service
anonymous
Anonymous
2021年05月06日
discount essay writing service <a href="http://writemyessayslfd.com/">write essay for money</a> civil service main essay
anonymous
Anonymous
2021年05月06日
non prescription viagra <a href="https://mrviagrashop.com">female viagra over the counter</a> sildenafil 20 mg walmart
anonymous
Anonymous
2021年05月07日
natural viagra <a href="https://mrviagrashop.com">sildenafil citrate 100mg</a> pills like viagra over the counter
anonymous
Anonymous
2021年05月07日
viagra alternatives <a href="https://mysildenafilkr.com/">buy viagra online cheap</a> viagra without prescription
anonymous
Anonymous
2021年05月07日
viagra 100mg <a href="https://mysildenafilkr.com/">viagra pills</a> non prescription viagra
anonymous
Anonymous
2021年05月11日
where can i buy cialis <a href="http://tadalafilled.com/">how to take cialis</a> cheapest cialis
anonymous
Anonymous
2021年05月11日
cost of cialis without insurance <a href="http://tadalafilled.com/">how to get cialis</a> cialis daily dose
anonymous
Anonymous
2021年05月11日
resume outlines <a href="http://coverletterforresumetop.com/">resume review service</a> production assistant resume
anonymous
Anonymous
2021年05月11日
entry level cover letter <a href="http://coverletterforresumetop.com/">it professional resume</a> personal trainer resume
anonymous
Anonymous
2021年05月12日
technical resume <a href="https://writingacoverletteronline.com/">review my resume</a> making a cover letter
anonymous
Anonymous
2021年05月12日
resume for graduate school <a href="https://writingacoverletteronline.com/">writing a cover letter for a job</a> resum
anonymous
Anonymous
2021年05月13日
20mg sildenafil <a href="https://edviagramaster.net/">sildenafil tab</a> viagra on steroids
anonymous
Anonymous
2021年05月13日
sildenafil walmart <a href="https://edviagramaster.net/">generic viagra names</a> viagra cvs
anonymous
Anonymous
2021年05月15日
viagra from india <a href="https://sildenafilviagratop.com">where to buy viagra</a> itsoktocry viagra
anonymous
Anonymous
2021年05月15日
viagra boys <a href="https://sildenafilviagratop.com">viagra for women</a> goodrx sildenafil
anonymous
Anonymous
2021年05月15日
does cialis lowers blood pressure <a href="https://cialisortadalafil.com/">online cialis</a> cialis side effects with alcohol
anonymous
Anonymous
2021年05月15日
cialis without a doctor prescription <a href="https://cialisortadalafil.com/">www.cialisortadalafil.com</a> buying cialis online safely
anonymous
Anonymous
2021年05月16日
where can i buy cialis <a href="https://topcialistabs.com/">how to take cialis</a> cheapest cialis
anonymous
Anonymous
2021年05月16日
difference between viagra and cialis <a href="https://topcialistabs.com/">canadian pharmacy cialis</a> cialis 20
anonymous
Anonymous
2021年05月18日
Drugs prescribing information. Effects of Drug Abuse. <a href="https://imodium4u.top">can i order imodium without dr prescription</a> in Canada Everything what you want to know about medicine. Read information now.
anonymous
Anonymous
2021年05月18日
Meds information sheet. What side effects can this medication cause? <a href="https://imodium4u.top">can you get generic imodium no prescription</a> in USA Actual about medication. Read here.
anonymous
Anonymous
2021年05月21日
<a href="https://5bz.ru/">база предприятий россии</a>
anonymous
Anonymous
2021年05月21日
<a href="https://5bz.ru/">база предприятий россии excel скачать торрент бесплатно</a>
anonymous
Anonymous
2021年06月02日
Drug information leaflet. Generic Name. <a href="https://januvia4u.top">how can i get januvia without dr prescription</a> in the USA Some information about pills. Read information here.