Skip to main content

Polite Moneycontrol data collector for trading research. Respects robots.txt; no anti-bot bypass.

Project description

moneycontrol_scraper_safe

A polite Moneycontrol data collector intended for trading research.

Principles

  • Respects robots.txt for every request via urllib.robotparser.
  • No bypassing of Cloudflare, login walls, paywalls, captchas, or rate limits.
  • Prefers official RSS feeds over HTML scraping.
  • Adds delay between requests (default 3s, honors any declared Crawl-delay).
  • Stores both raw and clean data so research is reproducible.
  • Outputs pandas DataFrames plus JSON / CSV files.

If a page is disallowed by robots.txt, or the server returns 401 / 403 / 429, the scraper stops and does not retry with tricks.

Install

pip install -r requirements.txt

Usage

# Fetch all configured RSS feeds and write clean output
python main.py rss --sentiment

# Limit to specific categories
python main.py rss --category latest_news ipo mutual_funds

# Fetch the public homepage / markets page (only if robots.txt allows)
python main.py html

# Both
python main.py all --sentiment

Set a contact email so site operators can reach you:

export MC_CONTACT="you@example.com"

Modules

Module Purpose
config.py URLs, feed list, delays, paths
robots_checker.py is_allowed() / crawl_delay() via urllib.robotparser
rss_collector.py Polite feed fetcher using requests + feedparser
html_collector.py Polite public-page fetcher (no auth, no bypass)
parser.py RSS + HTML → clean pandas DataFrames
sentiment.py Lightweight finance-flavoured sentiment scoring
storage.py Save raw payloads (data/raw/) and clean output (data/clean/)
cli.py argparse CLI: rss, html, all

Data layout

data/
├── raw/      # JSON payloads of feeds, raw HTML pages
└── clean/    # CSV + JSON of parsed/clean DataFrames

Categories collected

Latest market news, stock news, IPO news, economy news, business news, commodity news, personal finance news, mutual fund news, results / company headlines, and a best-effort market overview from the public homepage / markets page (only if robots.txt permits).

Disclaimer

This project is for personal research. Use the data in compliance with Moneycontrol's terms of service. Do not redistribute scraped content.

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

moneycontrol_datascraper-0.2.0.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

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

moneycontrol_datascraper-0.2.0-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

Details for the file moneycontrol_datascraper-0.2.0.tar.gz.

File metadata

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

File hashes

Hashes for moneycontrol_datascraper-0.2.0.tar.gz
Algorithm Hash digest
SHA256 69e019ee3eb7f6c813ac37ae9ce2fb63621737e7300ef82387723ce42ac5b0b6
MD5 225170210f599427464ad1e147574997
BLAKE2b-256 24693df4f50f9128ed795a55dde68874e685edfd0b9feb0386b3a8286867418e

See more details on using hashes here.

File details

Details for the file moneycontrol_datascraper-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for moneycontrol_datascraper-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4bde59ca69c4f0610fde8a171dc1d6f7d3d79c688875d8da139b420ba78f9bf6
MD5 7bcb5a1ccaef35dec6bad3abdcd5f3af
BLAKE2b-256 4a737e43ac648548bdee47b957d85d9d822fa5c9d0c55b04eec9b0b7dc9f3655

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