Skip to content
/ cats Public

A website to show cats of reddit scraped from 70+ subreddits via python

Notifications You must be signed in to change notification settings

msr8/cats

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation





  • Developed a website where random cat images and videos can be viewed
  • Used Python to scrape 9k+ cat pictures and videos from Reddit
  • Used JavaScript to display a random image/video from the scraped data
  • Used the pygal module to generate interactive and informative graphs regarding the scraped data
  • Hosted on github pages

This is the source code of a simple website for showing various cat pictures/videos people have posted on reddit and which members have upvoted. How it works is that a python script (gen.py) scrapes various cat posts in these cat subreddits, and stores all the data in a JSON file called files.json. This contains information about the post ID, link to the post, number of upvotes, username of OP, etc. Then in /random, script.js chooses a random image/video from the scraped data and displays it on the page. The various endpoints available are:


/

Homepage. Contains an inroduction to the site as well as links to other resources/webpages

/random

The main highlight of the site, shows a random cat image/video upon visiting/reloading the page

/stats

Contains various statistics about the scraped data (such as distribution of upvotes and domains) in the form of interactive graphs

/files.json

Contains all the scraped data in a human readable JSON format

/files.min.json

Contains the scraped data in a minified way, is almost 4x smaller than files.json