livemint-scraper-safe
A safe, ethical Python library for collecting public LiveMint financial and news data — designed as a clean NLP dataset builder for sentiment training and swing-trading research.
Live on PyPI: https://pypi.org/project/livemint-scraper-safe/
Quick start
pip install livemint-scraper-safe
# CLI
livemint-scraper --limit 10
# Python
python -c "from livemint_scraper import run_pipeline; print(run_pipeline(article_limit=5).head())"
This library does not produce trading signals on its own. Combine its sentiment output with technicals, volume, sector strength, and risk/reward in your trading engine. Suggested mix: Technical 40% | News Sentiment 25% | Volume 15% | Sector 10% | R:R 10%.
Principles
- Prefers official RSS feeds.
- Respects
robots.txt. - Does not bypass login, paywall, captcha, Cloudflare, or rate limits.
- Adds delay, retry, timeout, and logging.
- Saves raw and clean data to CSV and SQLite.
- Returns pandas DataFrames.
Pipeline
LiveMint RSS
↓
Deduplicate (md5 of title+link)
↓
Fetch Article Text (robots-aware)
↓
Normalize Date (dateutil)
↓
Map Stock Symbols (NSE/BSE tickers)
↓
Sentiment + Impact + Confidence
↓
Store in CSV + SQLite
Install
From PyPI:
pip install livemint-scraper-safe
From source (for development):
git clone <your-repo-url>
cd livemint_scraper_safe
pip install -r requirements.txt
Run
After install:
livemint-scraper --limit 15
From source:
python main.py
Outputs:
data/clean/livemint_news_<timestamp>.csvdata/livemint.db(SQLite, tablenews_clean)livemint_scraper.log
Programmatic use
import pandas as pd
from livemint_scraper import run_pipeline
stocks = pd.DataFrame([
{"symbol": "RELIANCE.NS", "name": "Reliance Industries"},
{"symbol": "TCS.NS", "name": "Tata Consultancy Services"},
])
df = run_pipeline(stocks_df=stocks, fetch_articles=True, article_limit=20)
print(df.head())
Sentiment engine
sentiment.analyze(text) returns:
{
"sentiment": "Bullish",
"sentiment_score": 3,
"impact": "High",
"confidence": 82,
"reason": "Detected bullish cues with high impact words."
}
Upgrade path (kept behind the same analyze() interface so callers don't change):
- Keyword sentiment (current)
- FinBERT
- LLM-based sentiment
- Market impact classifier
Output schema
news_id, source, category, title, summary, article_text, link,
published, published_at, fetched_at, company_symbols,
text_for_sentiment, sentiment_label, sentiment_score, impact_score,
confidence_score, sentiment_reason.
Folder structure
livemint_scraper_safe/
├── requirements.txt
├── main.py
├── README.md
├── livemint_scraper/
│ ├── __init__.py
│ ├── config.py
│ ├── http_client.py
│ ├── robots_checker.py
│ ├── rss_collector.py
│ ├── html_collector.py
│ ├── parser.py
│ ├── enrich.py
│ ├── dedup.py
│ ├── dates.py
│ ├── stocks.py
│ ├── sentiment.py
│ ├── storage.py
│ ├── logger.py
│ └── pipeline.py
└── data/
├── raw/
└── clean/
Metadata
Release files for livemint-scraper-safe 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| livemint_scraper_safe-0.1.1.tar.gz | 12.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| livemint_scraper_safe-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 27.1 kB
Release files / livemint_scraper_safe-0.1.1.tar.gz
| Download URL | livemint_scraper_safe-0.1.1.tar.gz |
|---|---|
| Size | 12.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
881156f99b2400b159deecba2bb9a36c7afb44aa4be6ff40614739dff205081e
|
|
BLAKE2b-256 checksum How to use checksums |
6ce0cf0c613aa4735af5fe77c97e693b175d47aff46bb11859e00391b57eca97
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Release files / livemint_scraper_safe-0.1.1-py3-none-any.whl
| Download URL | livemint_scraper_safe-0.1.1-py3-none-any.whl |
|---|---|
| Size | 14.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0fa29791138fc5b48fbc22b76e97fff4119a1ad6799e28c8d85bad9770336f67
|
|
BLAKE2b-256 checksum How to use checksums |
3a00361be1ba47eb69b2d71019c4bce8897efe5514a90b40b3ea247b17838b22
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Security for livemint-scraper-safe 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.