Top AI Repos — open-source AI, indexed and scored
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Use Web Scraper API to extract data from Google Finance, including stock titles, pricing, and price changes in percentages.
| Date | Stars |
|---|---|
| 2026-07-24 | 1207 |
| 2026-07-25 | 1213 |
| 2026-07-28 | 1229 |
| 2026-07-30 | 1243 |
| 2026-08-06 | 1248 |
Today
+5 stars today
This week
+5 stars this week
This month
— stars this month
Momentum
0.0
growth rate 0.40%/day
# How to Scrape Google Finance with Python
[](https://oxylabs.io/products/scraper-api/serp/google?utm_source=877&utm_medium=affiliate&groupid=877&utm_content=how-to-scrape-google-finance-github&transaction_id=102c8d36f7f0d0e5797b8f26152160)
[](https://discord.gg/Pds3gBmKMH) [](https://www.youtube.com/@oxylabs)
Follow this Python tutorial to learn how to scrape public data from Google Finance, such as **stock titles**, **pricing**, and **price changes in percentages**. We'll show how you can use Oxylabs' [Web Scraper API](https://oxylabs.io/products/scraper-api/web) for this task, which requires a subscription or a free trial. You can claim a **1-week free trial** by registering on the [Oxylabs dashboard](https://dashboard.oxylabs.io/).
- [Step 1: Install prerequisite libraries](#step-1-install-prerequisite-libraries)
- [Step 2: Build the core structure](#step-2-build-the-core-structure)
- [Step 3: Create a parsing logic](#step-3-create-a-parsing-logic)
* [1) Collect prices](#1-collect-prices)
* [2) Get the stock price change in %](#2-get-the-stock-price-change-in-percentages)
* [3) Retrieve the stock title](#3-retrieve-the-stock-title)
- [Complete code sample](#complete-code-sample)
## Step 1: Install prerequisite libraries
In your terminal, run this `pip` command:
```bash
pip install requests bs4
```
You may skip Beautiful Soup altogether and instead use [Custom Parser](https://oxylabs.io/features/custom-parser), which is built into the API.
## Step 2: Build the core structure
Next, let's define the general logic for the finance data scraper. We’ll create functionality for defining multiple Google Finance URLs that we’d like to scrape. Afterwards, we’ll take these URLs one by one, collect the information we need and save it as a JSON file. The following function will return the scraped Google Finance HTML page:
```python
import requests
from bs4 import BeautifulSoup
def get_finance_html(url):
payload = {
'source': 'google',
'render': 'html',
'url': url,
}
response = requests.request(
'POST',
'https://realtime.oxylabs.io/v1/queries',
auth=('username', 'password'), # User your API credentials here.
json=payload,
)
response_json = response.json()
html = response_json['results'][0]['content']
return html
```
> [!NOTE]
> Don’t forget to replace the **USERNAME** and **PASSWORD** with your own Oxylabs API credentials.
For the next step, we’ll be creating a function that accepts a `BeautifulSoup` object created from the HTML of the whole page. This function will create and return an object containing stock information. Let’s try to form the function in a way that makes it easy to extend (in case we need to.)
```python
def extract_finance_information_from_soup(soup_of_the_whole_page):
# Put data extraction here.
listing = {}
return listing
```
Since we can now get the HTML and have a function to hold our information extraction, we can combine both of those into one:
```python
def extract_finance_data_from_urls(urls):
constructed_finance_results = []
for url in urls:
html = get_finance_html(url)
soup = BeautifulSoup(html,'html.parser')
finance = extract_finance_information_from_soup(soup)
constructed_finance_results.append({
'url': url,
'data': finance
})
return constructed_finance_results
```
This function will take an array of URLs as a parameter and return an object of extracted financial data.
Last but not least, we need a function that takes this data and saves it as a file:
```python
def save_results(resuExcerpt of 9,826 characters
Read on GitHub5
4
Would you bet a product on this? Bounded 0–100 and slow moving.
matched fp:ba4a30b12fa231b2, topic:web-scraping, name:scrape, readme:scrape