In this tutorial, we are going to show you how to scrape stock info from Bloomberg.
To follow through, you may want to use these URLs in the tutorial:https://www.bloomberg.com/markets/stocks/world-indexes/americas https://www.bloomberg.com/markets/stocks/world-indexes/europe-africa-middle-east https://www.bloomberg.com/markets/stocks/world-indexes/asia-pacific
Here are the main steps in this tutorial: [Download task file here ]
- "Go To Web Page" - to open the target web page
- Create a "Loop Item" - to loop extract each element on each row
- Extract data - to select the data for extraction
- Start extraction - to run the task and get data
1. "Go To Web Page" - to open the target web page
- Click "+ Task" to start a new task
- Paste the URLs into the "Website" box and click "Save URL" to move on
2. Create a "Loop Item" - to loop extract each element on each row.
- Click the name of the "NASDAQ Transportation Index" in the first line.
Octoparse will automatically select the item and highlight it in green while other items with the same structure will be highlighted in red.
- Click "Expand selection area" icon on the "Action Tips" panel
We want to extract by rows rather than by columns. Clicking the "Expand selection area" will help us select the rows.
- Click "Select all sub-element" and then click "Select all" to create a loop list
Octoparse will detect all the sub-element with similar structures.
- Click "Extract data in the Loop"
3. Extract data - to select the data for extraction
After you click "Extract data in the loop", Octoparse will create data fields automatically. And if the fields are not what you need, you can delete them by clicking . Follow the steps below to add the fields you need:
- Select the information you need from the area highlighted in red and click "Extract text of the selected element"
- Edit the filed name by selecting the name from the predefined list names or create on your own
4. Save and start extraction - to run the task and get data
- Click “Start extraction” on the upper left side
- Select “Local extraction” to run the task on your computer, or select “Cloud Extraction” to run the task in the Cloud (for premium users only)
Here is the sample output:
Artículo en español: Scraping La Información sobre Acciones de Bloomberg
También puede leer artículos de web scraping en el website oficia