Skip to main content

Hackernews Scraper

Project description

Hackernews-Scraping

Tests

Business Requirements:

  1. Scrape TheHackernews.com and store the result (Description, Image, Title, Url) in mongo db
  2. Maintain two relations - 1 with the url and title of the blog and other one with url and its meta data like (Description, Image, Title, Author)

Requirements:

  • python3
  • pip
  • python libraries: _ requests _ BeautifulSoup4 _ pymongo _ jupyterlab * notebook
  • MongoDB
  • git

To run the application on your local machine:

Clone the repository:

  1. Type the following in your terminal

    git clone https://github.com/pushp1997/Hackernews-Scraping.git

  2. Change the directory into the repository

    cd ./Hackernews-Scraping

  3. Create python virtual environment

    python3 -m venv ./scrapeVenv

  4. Activate the virtual environment created

    • On linux / MacOS : source ./scrapeVenv/bin/activate
    • On Windows (cmd) : "./scrapeVenv/Scripts/activate.bat"
    • On Windows (powershell) : "./scrapeVenv/Scripts/activate.ps1"
  5. Install python requirements

    pip install -r requirements.txt

  6. Open the ipynb using jupyter notebook

    jupyter notebook "Hackernews Scraper.ipynb"

  7. Run the notebook, you will be asked to provide inputs for no of pages to scrape to get the post and your MongoDB database URI to store the posts data.

  8. Open mongodb shell connecting to the same URI you provided to the ipynb notebook while running it.

  9. Change the database

    use hackernews

  10. Print the documents in the 'url-title' collection

    db["url-title"].find().pretty()

  11. Print the documents in the 'url-others' collection

    db["url-others"].find().pretty()

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

hnscraper-0.1.0.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

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

hnscraper-0.1.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hnscraper-0.1.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.4 Linux/5.4.0-1074-azure

File hashes

Hashes for hnscraper-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3ae1fefda0ec3936ddfdc489f64c0779ced29d843e6a379d9bb2e81bd623aa1c
MD5 f5f95138523ce3b1c931c280e822516a
BLAKE2b-256 6885db4040bba551b9633fdd9a77015ec96ef0f5fa606a235d17150d2b6af23b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hnscraper-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.4 Linux/5.4.0-1074-azure

File hashes

Hashes for hnscraper-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4914d31b9f98a284b0066004c0bcb11a6c230ce534c9b4d4400ef5a514b1ab73
MD5 9a231e3e359a59039d4eba4940819e4a
BLAKE2b-256 af6ec3be257fa5fe699344b49e53dc71c2867bb85f4945ec0386b652090257a3

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