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

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.

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

pip install -r requirements.txt

Run

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.0.tar.gz (12.1 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.0-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: livemint_scraper_safe-0.1.0.tar.gz
  • Upload date:
  • Size: 12.1 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.0.tar.gz
Algorithm Hash digest
SHA256 29da288180db00df890bbdc22a71f1130b78b2c7fc008e54c0a979cc9b0b3620
MD5 9ebf9b9e118ba3df9600af923befda30
BLAKE2b-256 3d60de6405b5e383537ad1a31eb154b8113299001f486882ee70f8afe1eebe35

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for livemint_scraper_safe-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3b8694cdc305d8fb911ce3c68eefe24a0529a1e33a0508bbd578b87150152693
MD5 180018df10e4eaaaa9ff32ffe00619ec
BLAKE2b-256 98939b5c1010d1dee4c0316b7d4357464124fb43cd9992467bcb34f9ea30b990

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