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.1.1.tar.gz (10.1 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.1.1-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: moneycontrol_datascraper-0.1.1.tar.gz
  • Upload date:
  • Size: 10.1 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.1.1.tar.gz
Algorithm Hash digest
SHA256 597d3466d75cc219c0e921949919b611dfeca10ba4c0326659e86e4482081973
MD5 611e408d9a04929fc30578573e11de48
BLAKE2b-256 654d1bf4666d4a60820e02b16409188ee51c9c9bcbc5e457359fbfa4925ec13a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for moneycontrol_datascraper-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 11c3ff9b24cb287607e51f2a4b2b10b5019dece4f53ba1b08d74623d357ad855
MD5 d0fc521fcc21cf31ecd77b0b35a39372
BLAKE2b-256 5bd3194a92688bad2e7fd31cfc31b5aa0e50fbae2ace8ec6fe80dc3a13c93403

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