Giter Club home page Giter Club logo

trending-github's Introduction

trending-github

Simple API for getting trending repositories on Github

Travis npm version npm downloads npm license eslint

Installation

npm install trending-github --save

Usage

const trending = require('trending-github');

trending()
  .then(repos => console.log(repos));

//=> [{
//=>   author: 'asciimoo',
//=>   name: 'wuzz',
//=>   href: 'https://github.com/asciimoo/wuzz',
//=>   description: 'Interactive cli tool for HTTP inspection',
//=>   language: 'Go',
//=>   stars: 966,
//=>   forks: 20,
//=>   starsInPeriod: 153
//=> }, ... ]
const trending = require('trending-github');

trending('weekly', 'javascript')
  .then(repos => console.log(repos));

//=> [{
//=>   author: 'freeCodeCamp',
//=>   name: 'freeCodeCamp',
//=>   href: 'https://github.com/freeCodeCamp/freeCodeCamp',
//=>   description: 'The https://freeCodeCamp.com open source codebase and curriculum. Learn to code and help nonprofits.',
//=>   language: 'JavaScript',
//=>   stars: 229260,
//=>   forks: 9289
//=>   starsInPeriod: 42
//=> }, ... ]

License

MIT © Daniel Eckermann

trending-github's People

Contributors

ecrmnn avatar marcelscruz avatar mkusaka avatar ponsfrilus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

trending-github's Issues

Title format changed, author wrong, title not extracted anymore

Hi,

I currently have the problem that the name is always undefined. After a bit research of the rootcause it seems GitHub changed the format of the title and added \n after the /, so the split doesn't work anymore.

It seems it can be easily fixed by changing line 23 to:

const var title = $(repo).find('h1.h3 a').text().replace(/\s/g, '');

and line 29/30 to:

   author: title.split('/')[0],
   name: title.split('/')[1],

After that change it works for me locally and in my little project, see https://github-rssfeeds.herokuapp.com/trending.

Repo description is always null

Repo's descriptions are always null, i.e. the selector .find('p .py-1').text() is not returning anything anymore. Need to be replaced with .find('.py-1 > p').text().

Adopt the library to HTML changes of GitHub

Hey, it seems there are changes in the HTML of GitHub and the library doesn't return any trending now. It would be nice to get an updated version aligned to the changes.

What I changed to fix it on my side:

  • Repository containers: $('li', 'ol.repo-list') => $('article')
  • Title: $(repo).find('h3') => $(repo).find('h1.h3 a')
  • Description: $(repo).find('.py-1 > p') => $(repo).find('p')

With these changes all data are filled except the amount of forks which is not anymore available.

Care about maybe there are different layouts, so it's maybe needed to support multiple ones and the selectors are relative general and it's maybe worth to exchange them with more precise ones.

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.