Skip to main content

Ethical LiveMint news collector (RSS-first, robots-aware) that produces a clean NLP dataset for sentiment training and swing-trading research.

Project description

livemint-scraper-safe

PyPI version Python versions License: MIT

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>.csv
  • data/livemint.db (SQLite, table news_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):

  1. Keyword sentiment (current)
  2. FinBERT
  3. LLM-based sentiment
  4. 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/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

livemint_scraper_safe-0.1.1.tar.gz (12.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

livemint_scraper_safe-0.1.1-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

Details for the file livemint_scraper_safe-0.1.1.tar.gz.

File metadata

  • Download URL: livemint_scraper_safe-0.1.1.tar.gz
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for livemint_scraper_safe-0.1.1.tar.gz
Algorithm Hash digest
SHA256 881156f99b2400b159deecba2bb9a36c7afb44aa4be6ff40614739dff205081e
MD5 895e6cf556d775032b670c96e9e0fb2a
BLAKE2b-256 6ce0cf0c613aa4735af5fe77c97e693b175d47aff46bb11859e00391b57eca97

See more details on using hashes here.

File details

Details for the file livemint_scraper_safe-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for livemint_scraper_safe-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0fa29791138fc5b48fbc22b76e97fff4119a1ad6799e28c8d85bad9770336f67
MD5 9b7d3fa4a2471588a50fdc7180a621eb
BLAKE2b-256 3a00361be1ba47eb69b2d71019c4bce8897efe5514a90b40b3ea247b17838b22

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page