HTML - Finding block-details

jamescooper

Well-known Member
Joined
Sep 8, 2014
Messages
840

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
http://greyhoundbet.racingpost.com/meeting/blocks.sd?r_date=2018-03-16&view=time&blocks=header,list

Looks like this is the URL:

Trying to pull from this: http://greyhoundbet.racingpost.com/#meeting-list/r_date=2018-03-16

The 10:29 Harlow, 10:36 Crayford etc....

Trying to code it, have the JSONCONVERT in a module

Code:
Sub Dog_Form()


    Dim LastRow     As Long
    Dim x           As Long
    Dim urls        As Variant
    Dim dogLinks    As Variant
    
    LastRow = Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Row
    urls = Sheets("Sheet1").Range("A1:A" & LastRow).Value
    
    For x = LBound(urls) To UBound(urls)
        dogLinks = getDogForm(urls(x, 1))
        Sheets("Sheet1").Cells(Sheets("Sheet1").Rows.Count, 8).End(xlUp).Offset(1).Resize(UBound(dogLinks), 2).Value2 = dogLinks
    Next x


End Sub


Private Function getDogForm(ByVal url As String) As Variant


    Dim items   As Collection
    Dim item    As Object
    Dim ret()   As Variant
    Dim x       As Long
    Dim dogName As String
    Dim trapNum As String
    Dim dateOfBirth As String
    Dim dogId As String


    With CreateObject("msxml2.xmlhttp")
       .Open "GET", url, False
       .send
       Set List = JSONConvert.ParseJson(.responseText)("list")
    End With
    
    Set items = List("items")
    
    raceDate = Lists("races")("raceDate")
    
    
    ReDim ret(1 To items.Count, 1 To 2)
        
    For Each item In items
        x = x + 1
        ret(x, 1) = raceDate
        ret(x, 2) = item("trackShortName")
        
    Next item
    
    getDogForm = ret
    
End Function

Thanks.
 
Upvote 0

Forum statistics

Threads
1,224,747
Messages
6,180,719
Members
452,995
Latest member
isldboy

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top