OaklandJim
Well-known Member
- Joined
- Nov 29, 2018
- Messages
- 855
- Office Version
- 365
- Platform
- Windows
Am trying to scrape Morningstar web pages for funds data. In the past I paid up to get help with this as it is beyond my abilities. I'll pay up again if I have to.
Anyway, before Morningstar redesigned their web pages the following code used to pull in the entire html source for a web url.
Now it pulls in text that looks a lot different than the source does when I look at it and save it using a browser. Specifically the code pulls in SOME html but it is a much smaller file (55k chars) than the source (~1.8 million chars ) that I see/save using the browser.
In the latter I can see my data and its tags and know how to parse to get it. BUT I cannot get the "full" source code to parse. The "small" source I get does not have my data in it.
Also, I presume that VBA string vars and string functions can handle that many chars?
Here is a typical URL for me. This is for an ETF
Here is one for a mutual fund
Anyway, before Morningstar redesigned their web pages the following code used to pull in the entire html source for a web url.
VBA Code:
Function GetSource(sURL As String) As String
Dim oXHTTP As Object
Set oXHTTP = CreateObject("MSXML2.XMLHTTP")
On Error GoTo haveError
oXHTTP.Open "GET", sURL, False
oXHTTP.send
GetSource = oXHTTP.responsetext
Set oXHTTP = Nothing
Exit Function
haveError:
Debug.Print "Error in Function GetSource for URL " & sURL
Err.Clear
GetSource = ""
Set oXHTTP = Nothing
End Function
Now it pulls in text that looks a lot different than the source does when I look at it and save it using a browser. Specifically the code pulls in SOME html but it is a much smaller file (55k chars) than the source (~1.8 million chars ) that I see/save using the browser.
In the latter I can see my data and its tags and know how to parse to get it. BUT I cannot get the "full" source code to parse. The "small" source I get does not have my data in it.
Also, I presume that VBA string vars and string functions can handle that many chars?
Here is a typical URL for me. This is for an ETF
Vanguard Real Estate ETF (VNQ) Quote | MorningstarLearn about VNQ with our data and independent analysis including price, star rating, asset allocation, capital gains, and dividends. Start a 14-day free trial to Morningstar Premium to unlock our take on VNQ.
www.morningstar.com
|
Here is one for a mutual fund
Vanguard Wellington™ Inv (VWELX) Quote | MorningstarLearn about VWELX with our data and independent analysis including NAV, star rating, asset allocation, capital gains, and dividends. Start a 14-day free trial to Morningstar Premium to unlock our take on VWELX.
www.morningstar.com
|