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.0.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.0-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: moneycontrol_datascraper-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 cdde81b295bf966d44e63205df15a05bc0b28d4a4aa830543fb5d6568f431310
MD5 4ee37c53203b10865f0143e7f92f4943
BLAKE2b-256 1710a8becb52007186286d9716423e8ce591b2fb240761ca90eb1db9b17842fc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for moneycontrol_datascraper-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8f4292ef991ffb1f7e769bb6b80923167c0a1b97f4ade633ca1eecbacb7027b2
MD5 305b1a1d24adc6b3b79dc0201040e649
BLAKE2b-256 d7ccccd3d1ef7e8005f3c893403b753331d5897bd4afc2e45e7f45009c06860f

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