Coder Social home page Coder Social logo

akkamath / competitive-application Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 5.0 72 KB

Application in PHP to fetch all upcoming Competitive Programming Competitions across various sites, and display in a formatted manner.

PHP 73.63% CSS 16.53% JavaScript 5.91% Hack 3.93%
hacktoberfest

competitive-application's Introduction

Competitive-Application

Application to grab details of upcoming competitive coding competitions from their respective websites.

Execution Instructions

  • Clone repository, navigate to the directory and run the following commands:
     cd public
     php -S localhost:8080
    
  • Now go here: http://localhost:8080
  • Wait a few minutes for data to be gathered.

Adding More Site

The following steps can be undertaken to scrape data from a custom site:

  • Create a file in controllers folder in the format c_YourSiteName.php
<?php
// Include the class that we create objects of
require("../models/m_contest.php");

scrape_site();

function scrape_site()
{
	// YOUR CODE HERE
}
  • Copy the above template into this file
  • In scrape_site(), scrape the site into an array of type contest defined here.
  • Each object of the array represents a single competition.
  • For error checking, echo "INV"; and exit;
  • After gathering details, echo the json_encode($arr);
  • Edit websites.json in the root directory, by adding the site name and folder location of the scraper.
  • Optionally add a picture of the site logo to the images folder in public.

Explanation of File Structure

  • controllers folder contains all the scraping logic.
  • models folder currently only contains m_contest.php which contains a class contest describing the details required for a class.
  • public contains the index.php and logos of competitive coding sites.

TODOs

  • Change to JavaScript and Ajax, instead of PHP output.
  • Implement a way so that all files relating to a single competitive site are gathered together.
  • Improve formatting of data
  • Implement raw data storage so that user isn't forced to wait while data is gathered.
  • Port to Python as a standalone application.
Other

Credits to:
Jack Rugile (https://codepen.io/jackrugile/full/EyABe) for the table structure.

competitive-application's People

Contributors

akkamath avatar joefearnley avatar owenvoke avatar shane-gray avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

competitive-application's Issues

Implement raw data storage.

Implement a form of "cache" using file systems so that the application can run offline by using previously scraped data. This would basically involve saving the data after scraping, and reading previously scraped data while data is being scraped.

Change to JavaScript and Ajax, instead of PHP output.

Currently the main file includes each scraping file then takes the output of that file. It would be more practical and efficient to instead have the main file use JavaScript and Ajax, and request the data from the PHP file.

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.