GithubHelp home page GithubHelp logo

ruddfawcett / octodex-scraper Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 0.0 200 KB

The backend for the unofficial OctodexAPI. This repo is a PHP scraper/api for GitHub's Octodex website, which can be found at http://octodex.github.com.

Home Page: https://octodexapi.herokuapp.com/

PHP 100.00%

octodex-scraper's Introduction

octodex-scraper

A PHP scraper for http://octodex.github.com. You could use the feedburner RSS and parse that XML, but it doesn't show the author or author avatar, and I wanted to experiment with PHP's DOM.

##Use The scraper is located at https://octodexapi.heroku.com (changed from octodex-scraper.heroku.com). You can cURL the page for the JSON, or file_get_contents it in PHP, or whatever language you are using.

##Endpoints ###Random Octocats To get a random Octocat, append ?random to the url: https://octodex-scraper.heroku.com/?random. The response will be the same as the full Octodex, but it will just be one Octocat (obviously).

###Octocat by Number To fetch an Octocat by its number, add number={octocat-number} to your URL.

Note: For obvious reasons, you cannot fetch a random AND numbered Octocat.

##JSON Response Standard JSON for each Octocat - grabbing a random one, and the whole set.

{
    "name": "original",
    "page": "http://octodex.github.com/original",
    "image": "http://octodex.github.com/images/original.png",
    "author": "http://octodex.github.com/original",
    "number": "1",
    "authorURL": "http://www.idokungfoo.com",
    "authorAvatar": "https://img.skitch.com/20110427-p3wtwcbu957cf9mm93s4sjqqci.png"
}

###Keys

  • name - the name of the octocat
  • page - the webpage of the octocat
  • image - the raw image URL of the octocat
  • author - the creator of the octocat
  • number - the number of the octocat in the series
  • authorURL - the URL of the author (GitHub/Website)
  • authorAvatar - the avatar of the author

##To Do

  • Add pagination
  • More efficient random Octocats
  • More efficient numbered Octocats

##Use of Octocats Check out the GitHub Octodex frequently asked questions (http://octodex.github.com/faq), for specific use. GitHub owns all of the Octocats, this scraper just grabs all of their data.

octodex-scraper's People

Stargazers

 avatar  avatar Paul Reny avatar Rudd Fawcett avatar

Watchers

Rudd Fawcett avatar  avatar

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.