Giter Club home page Giter Club logo

creepycrawler's Introduction

Creepy Crawler

A Python crawler specializing in CreepyPasta stories


Note

This project was built for educational purposes only. Crawl rate is automatically set based on what robots.txt allows.

Simple crawler created in Python 3.10. Visits the CreepyPasta website and does two things, as separate processes:

  • Downloads all the story links it finds and stores each one alongside its rating in resources/links.jsonl.
  • Reads the contents of resources/links.jsonl, follows each link and stores its contents in a MySQL DB entry, alongside its rating, reading time and categories.

Plugin dependencies

Finding story links to download

The main entry point for this part of the process is crawler/creepyCrawlerLinks.py, which contains the LinkSpider class. It uses scrapy to retrieve all story links.

It is called from main.py, using:

cmdline.execute("scrapy runspider crawler/creepyCrawlerLinks.py -o resources/links.jsonl".split())

After executing this code for the first time, you can set DOWNLOAD_LINKS = False in definitions.py, so that you can work with offline data only.

If you want to download the links multiple times, you will need to delete the resources/links.jsonl file before each new execution.

Downloading the stories

The main entry point for this part of the process is crawler/creepyCrawlerStories.py, which contains the StoriesSpider class. This also uses scrapy, this time to download the actual stories. For storing them to the DB, it uses MySQL Connector (Python).

It is called from main.py, using:

cmdline.execute("scrapy runspider crawler/creepyCrawlerStories.py".split())

You can set DOWNLOAD_STORIES = False in definitions.py, if you only want to download the story links with their ratings.

Storing data

After the code runs, the stories will be stored in your local MySQL server instance.

You will need to create your creepystore database manually. The table on which stories will eventually be stored, will be created by the code in database/mysqlPipeline.py, if it does not exist.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.