Forum Discussion

mmickle23's avatar
mmickle23
Regular Visitor
1 year ago
Solved

Scrape Fantasy Baseball Site

Hello-   I would like to scrape the data from a table on my fantasy baseball site.  I think the list is being rendered using javascript.  Not 100% sure though.  In the past I have seen URLs that wo...
  • jgeddes's avatar
    1 year ago

    You might be able to get what you want with this code...

    let
        url = "https://atl-01.statsplus.net/ohbl/draftajax/",
        formData = "{""info"":""round"",""lid"":""100"", ""round"":""All""}",
        formDataJson = Text.ToBinary(Uri.BuildQueryString(Json.Document(formData))),
        response = Web.Contents(url, [Content=formDataJson, Headers=[#"Content-Type"="application/x-www-form-urlencoded"]]),
        htmlTable = Html.Table(response, {{"Round", "TD:nth-child(1)"}, {"Pick", "TD:nth-child(2)"}, {"Overall", "TD:nth-child(3)"}, {"Team", "TD:nth-child(4)"}, {"Selection", "TD:nth-child(5)"}, {"Column6", ".active .player-name-modal"}, {"Pick Time", "TD:nth-child(6)"}, {"Column8", "SUP"}}, [RowSelector="TD:nth-child(1)"])
    
    in
        htmlTable

    Hope this points you in the right direction.