Implementation:AI4Finance Foundation FinGPT Eastmoney Content Downloader
| Knowledge Sources | |
|---|---|
| Domains | Data_Acquisition, News_Scraping, Chinese_Market |
| Last Updated | 2026-10-18 00:00 GMT |
Overview
Concrete tool for downloading Eastmoney (guba.eastmoney.com) news article contents via multiprocessing web scraping with proxy support provided by the FinGPT Sentiment Analysis v1 subproject.
Description
The download_contents module reads a CSV of news titles with content links, scrapes each article page from Eastmoney's Guba forum, extracts JSON-embedded content from script tags, and saves the enriched DataFrame. It supports KuaiDaili tunnel proxies and multiprocessing for parallel fetching with retry logic.
Usage
Run as a script when you need to enrich Eastmoney news title datasets with full article content. Requires pre-existing title CSVs.
Code Reference
Source Location
- Repository: AI4Finance_Foundation_FinGPT
- File: fingpt/FinGPT_Sentiment_Analysis_v1/FinGPT_v1.0/data_preparations/download_contents.py
- Lines: 1-165
Signature
def get_one_content(x) -> pd.Series | None:
"""Fetch a single Eastmoney Guba article and extract its content JSON.
Args:
x: DataFrame row with 'content link' column
Returns:
pd.Series of extracted content or None on failure
"""
Import
# Script — invoke directly after setting result paths
# python download_contents.py
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| result_path | str | Yes | Directory with title-only CSVs |
| result_with_content_path | str | Yes | Output directory for enriched CSVs |
| KUAIDAILI_TUNNEL | str | No | Proxy tunnel env var |
Outputs
| Name | Type | Description |
|---|---|---|
| enriched CSVs | files | Title CSVs with added content column |
Usage Examples
Download Article Contents
from download_contents import get_one_content
import pandas as pd
titles_df = pd.read_csv("results/600519.csv")
content = get_one_content(titles_df.iloc[0])
if content is not None:
print(content.get("post_content", "")[:200])