• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: Scraping data off Morningstar – Portfolio Screen

Resolved: Scraping data off Morningstar – Portfolio Screen

0
By Isaac Tonny on 15/03/2023 Issue
Share
Facebook Twitter LinkedIn

In this post, we will see how to resolve Scraping data off Morningstar – Portfolio Screen

Question:

I am trying to scrape data from this link https://www.morningstar.com/funds/xnas/gibix/portfolio — basically all the data I can get, but particularly the Fixed Income Style Table and the Exposure, Bond Breakdown table.
Here is my code:
The above code is for what I have scraping the holdings data at the bottom. But it seems like I am having trouble figuring out what my 'component' field in my header should be. I have tried even 'sal-components-fixed-income-exposure-analysis' but to no avail.

Best Answer:

What you are doing is not web scraping, but an API request. There’s probably a way to get the data you want through the API but you might have to discover it from their docs: https://developer.morningstar.com/developer-resources/api-visualization-library/about
But I can provide you with a code snippet for actually scraping the data from this page:
“tables” here is a list of dataframes from every table found in the page when fully loaded.
To install lxml module just pip install lxml
Ps: I tried getting the html with a request response but it’s returning another page, looks like you gotta open the page and wait until it’s fully loaded to get the correct source html.

If you have better answer, please add a comment about this, thank you!

Source: Stackoverflow.com

finance python python-requests web-scraping
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: EntityFramework creates/runs migrations using parameterless DataContext instance

24/03/2023

Resolved: Visual Studio 2022 crashes when using breakpoints

24/03/2023

Resolved: How to get Union type from an array of objects in Flow?

24/03/2023

Comments are closed.

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.