Code Monkey home page Code Monkey logo

node-github-trend's Introduction

Scraping GitHub Trending Repositories

npm version Build Status

github-trend is a library for scraping GitHub trending repositories.

Only scraping

const Trending = require('github-trend');
const scraper = new Trending.Scraper();

// Empty string means 'all languages'
scraper.scrapeTrendingReposFullInfo('').then(repos => {
    for (const repo of repos) {
        console.log(repo.owner);
        console.log(repo.name);
        console.log(repo.description);
        console.log(repo.language);
        console.log(repo.allStars);
        console.log(repo.todaysStars);
        console.log(repo.forks);
    }
}).catch(err => {
    console.error(err.message);
});

// For other languages
scraper.scrapeTrendingReposFullInfo('rust');
scraper.scrapeTrendingReposFullInfo('vim');
scraper.scrapeTrendingReposFullInfo('go');

Scraper only scrapes GitHub trending page. This returns an array of repository information. This method is relatively faster because of sending request only once per language.

Scraping and getting full repository information

const Trending = require('github-trend');
const client = new Trending.Client();

client.fetchTrending('').then(repos => {
    for (const repo of repos) {
        // Result of https://api.github.com/repos/:user/:name
        console.log(repo);
    }
}).catch(err => {
    console.error(err.message);
});

// Fetch all API call asynchronously
client.fetchTrendings(['', 'vim', 'go']).then(repos => {
    for (const lang in repos) {
        for (const repo of repos[lang]) {
            // Result of https://api.github.com/repos/:user/:name
            console.log(repo);
        }
    }
}).catch(err => {
    console.error(err.message);
});

Client contains scraper and scrapes GitHub trending page, then gets all repositories' full information using GitHub /repos/:user/:name API. This takes more time than only scraping, but all requests are sent asynchronously and in parallel.

Scraping language information

const Trending = require('github-trend');
const scraper = new Trending.Scraper();

scraper.scrapeLanguageYAML().then(langs => {
    for (const name in langs) {
        console.log(name);
        console.log(langs[name]);
    }
}).catch(err => {
    console.error(err.message);
});

This returns all languages information detected in GitHub by scraping here. The result is cached and reused.

Scraping language colors

const Trending = require('github-trend');
const scraper = new Trending.Scraper();

scraper.scrapeLanguageColors().then(colors => {
    for (const name in colors) {
        console.log('name: ' + name);
        console.log('color: ' + colors[name]);
    }
}).catch(err => {
    console.error(err.message);
});

// If you want only language names:
scraper.scrapeLanguageNames().then(names => {
    for (const name of names) {
        console.log(name);
    }
}).catch(err => {
    console.error(err.message);
});

Collect trending repositories by scraping and GitHub API

By scraping GitHub Trending Repositories page, the information is restricted to the information rendered in the page. This library also supports to getting information of trending repositories using GitHub Repositories API.

Although an API token (at the first parameter of new Client) is not mandatory, it is recommended for avoiding API rate limit.

const {Client} = require('github-trend');
const client = new Client({token: 'API access token here'});

client.fetchTrending('all').then(repos => {
    for (const repo of repos) {
        console.log('Name:', repo.full_name);
        console.log('ID:', repo.id);
        console.log('Topics:', repo.topics.join(' '));
        console.log('License:', repo.license.name);
    }
}).catch(console.error);

License

Distributed under the MIT license.

node-github-trend's People

Contributors

bumbeishvili avatar madnight avatar mikeq avatar rhysd avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

node-github-trend's Issues

Cannot read property 'data' of undefined

TypeError: Cannot read property 'data' of undefined
    at /home/x/trendy/node_modules/github-trend/build/main.js:72:65
    at Array.map (<anonymous>)
    at /home/x/trendy/node_modules/github-trend/build/main.js:40:18
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

Thats happens when i try to execute the example code:

var Trending = require("github-trend");
var scraper = new Trending.Scraper();
 
// Empty string means 'all languages' 
scraper.scrapeTrendingReposFullInfo("").then(function(repos){
    repos.forEach(function(repo){
        console.log(repo.owner);
        console.log(repo.name);
        console.log(repo.description);
        console.log(repo.language);
        console.log(repo.allStars);
        console.log(repo.todaysStars);
    });
}).catch(function(err){
    console.log(err.message);
});

scrapeTrendingRepos works fine, so this issue is only related to scrapeTrendingReposFullInfo

Extend parser functionality

Right now parser only returns trending repository name and owner info in following format

{
     name:"Repo name",
     owner:"Repo owner"
}

although it's possible to extract more info (without additional api calls)

I have implemented method to extract following data format

{
      name: null,
      owner: null,
      description: null,
      language: null,
      allStars: null,
      todaysStars: null,
}

add method body

    Scraper.prototype.scrapeTrendingReposFullInfo = function (lang_name) {
        return this.fetchTrendPage(lang_name).then(function (html) {
            var dom = cheerio.load(html);
            return dom(".repo-list li")
                .toArray()
                .map(function (li, i) {
                    var result = {
                        index: i,
                        name: null,
                        owner: null,
                        description: null,
                        language: null,
                        allStars: null,
                        todaysStars: null,
                    }
                    //extract owner and repo name
                    var domElem = dom(li);
                    var a = domElem.find('h3 a').toArray()[0];

                    var href = a.attribs["href"];
                    var match = href.match(RE_HREF_SCRAPE);

                    if (!match) {
                        console.log("Invalid repo: " + href);
                    }

                    result.owner = match[1];
                    result.name = match[2];

                    //extract description
                    var p = domElem.find('p').toArray()[0];
                    if (p) {
                        result.description = p.children[0].data
                    }

                    //extract programming language
                    var lang = domElem.find('[itemprop="programmingLanguage"]').toArray()[0];
                    if (lang) {
                        result.language = lang.children[0].data
                    }

                    //extract all stars
                    var allStars = domElem.find('[aria-label="Stargazers"]').toArray()[0];
                    if (allStars) {
                        result.allStars = allStars.children[2].data
                    }

                    //extract todays stars
                    var todaysStars = domElem.find('.text-gray span:last-child').toArray()[0];
                    if (todaysStars) {
                        result.todaysStars = todaysStars.children[2].data
                    }


                    //clean result
                    var emptyStringmatcher = /^\s+|\s+$/g;

                    var keys = Object.keys(result);

                    keys.forEach(k => {
                        if (typeof result[k] === 'string' || result[k] instanceof String) {
                            result[k] = result[k].replace(emptyStringmatcher, '');
                        }
                    });

                    return result;
                });
        });
    };

Invoking is same

scraper.scrapeTrendingReposFullInfo('csharp')
                .then(repos => {
                    console.log(repos)
                 });

and result is following

[
   {
      "index":0,
      "name":"shadowsocks-windows",
      "owner":"shadowsocks",
      "description":"If you want to keep a secret, you must also hide it from yourself.",
      "language":"C#",
      "allStars":"7,586",
      "todaysStars":"23 stars today"
   },
   {
      "index":1,
      "name":"BaiduPanDownload",
      "owner":"Mrs4s",
      "description":"百度网盘不限速下载工具",
      "language":"C#",
      "allStars":"2,296",
      "todaysStars":"19 stars today"
   },
   {
      "index":2,
      "name":"dapper-dot-net",
      "owner":"StackExchange",
      "description":"Dapper - a simple object mapper for .Net",
      "language":"C#",
      "allStars":"5,602",
      "todaysStars":"14 stars today"
   },
   {
      "index":3,
      "name":"corefx",
      "owner":"dotnet",
      "description":"This repo contains the .NET Core foundational libraries, called CoreFX. It includes classes for collections, file systems, console, XML, async and many others.",
      "language":"C#",
      "allStars":"11,135",
      "todaysStars":"11 stars today"
   },
   {
      "index":4,
      "name":"Lite.Abstractions",
      "owner":"AspectCore",
      "description":"AspectCore Lite is an lightweight aop lib for Asp.Net Core Framework.",
      "language":"C#",
      "allStars":"23",
      "todaysStars":"13 stars today"
   },
   {
      "index":5,
      "name":"LightBulb",
      "owner":"Tyrrrz",
      "description":"Background application that adjusts screen gamma as the day goes, reducing blue light when it gets late (C#/WPF/MVVM)",
      "language":"C#",
      "allStars":"83",
      "todaysStars":"11 stars today"
   },
   {
      "index":6,
      "name":"shadowsocksr-csharp",
      "owner":"shadowsocksr",
      "description":"ShadowsocksR for Windows",
      "language":"C#",
      "allStars":"1,358",
      "todaysStars":"11 stars today"
   },
   {
      "index":7,
      "name":"BotBuilder",
      "owner":"Microsoft",
      "description":"The Microsoft Bot Builder SDK is one of three main components of the Microsoft Bot Framework. The Microsoft Bot Framework provides just what you need to build and connect intelligent bots that interact naturally wherever your users are talking, from text/SMS to Skype, Slack, Office 365 mail and other popular services.",
      "language":"C#",
      "allStars":"3,387",
      "todaysStars":"10 stars today"
   },
   {
      "index":8,
      "name":"Radarr",
      "owner":"Radarr",
      "description":"A fork of Sonarr to work with movies à la Couchpotato.",
      "language":"C#",
      "allStars":"231",
      "todaysStars":"11 stars today"
   },
   {
      "index":9,
      "name":"hakchi2",
      "owner":"ClusterM",
      "description":"NES Mini pimp tool",
      "language":"C#",
      "allStars":"123",
      "todaysStars":"10 stars today"
   },
   {
      "index":10,
      "name":"CefSharp",
      "owner":"cefsharp",
      "description":".NET (WPF and Windows Forms) bindings for the Chromium Embedded Framework",
      "language":"C#",
      "allStars":"2,682",
      "todaysStars":"7 stars today"
   },
   {
      "index":11,
      "name":"PowerShell",
      "owner":"PowerShell",
      "description":"PowerShell for every system!",
      "language":"C#",
      "allStars":"5,971",
      "todaysStars":"8 stars today"
   },
   {
      "index":12,
      "name":"MaterialDesignInXamlToolkit",
      "owner":"ButchersBoy",
      "description":"Google's Material Design in XAML & WPF, for C# & VB.Net.",
      "language":"C#",
      "allStars":"2,285",
      "todaysStars":"8 stars today"
   },
   {
      "index":13,
      "name":"Hangfire",
      "owner":"HangfireIO",
      "description":"An easy way to perform background processing in your .NET and .NET Core applications",
      "language":"C#",
      "allStars":"2,275",
      "todaysStars":"8 stars today"
   },
   {
      "index":14,
      "name":"ToolGood.Words",
      "owner":"toolgood",
      "description":"一款高性能非法词(敏感词)检测组件,附带繁体简体互换,支持全角半角互换,获取拼音首字母,获取拼音字母等功能。",
      "language":"C#",
      "allStars":"36",
      "todaysStars":"7 stars today"
   },
   {
      "index":15,
      "name":"Mvc",
      "owner":"aspnet",
      "description":"ASP.NET Core MVC is a model view controller framework for building dynamic web sites with clean separation of concerns, including the merged MVC, Web API, and Web Pages w/ Razor.",
      "language":"C#",
      "allStars":"3,853",
      "todaysStars":"7 stars today"
   },
   {
      "index":16,
      "name":"dnSpy",
      "owner":"0xd4d",
      "description":".NET assembly editor, decompiler, and debugger",
      "language":"C#",
      "allStars":"1,430",
      "todaysStars":"7 stars today"
   },
   {
      "index":17,
      "name":"LiteDB",
      "owner":"mbdavid",
      "description":"LiteDB - A .NET NoSQL Document Store in a single data file -",
      "language":"C#",
      "allStars":"1,197",
      "todaysStars":"7 stars today"
   },
   {
      "index":18,
      "name":"SignalR",
      "owner":"aspnet",
      "description":"Incredibly simple real-time web for ASP.NET Core",
      "language":"C#",
      "allStars":"283",
      "todaysStars":"7 stars today"
   },
   {
      "index":19,
      "name":"coreclr",
      "owner":"dotnet",
      "description":"This repo contains the .NET Core runtime, called CoreCLR, and the base library, called mscorlib. It includes the garbage collector, JIT compiler, base .NET data types and many low-level classes.",
      "language":"C#",
      "allStars":"7,263",
      "todaysStars":"5 stars today"
   },
   {
      "index":20,
      "name":"VRTK",
      "owner":"thestonefox",
      "description":"A productive VR Toolkit for rapidly building VR solutions in Unity3d.",
      "language":"C#",
      "allStars":"1,156",
      "todaysStars":"5 stars today"
   },
   {
      "index":21,
      "name":"WeiXinMPSDK",
      "owner":"JeffreySu",
      "description":"微信公众平台SDK Senparc.Weixin for C#,支持.NET Framework及.NET Core。已支持微信公众号、小程序、企业号、企业微信、开放平台、微信支付、JSSDK、微信周边。 WeChat SDK for C#.",
      "language":"C#",
      "allStars":"1,638",
      "todaysStars":"5 stars today"
   },
   {
      "index":22,
      "name":"mono",
      "owner":"mono",
      "description":"Mono open source ECMA CLI, C# and .NET implementation.",
      "language":"C#",
      "allStars":"5,193",
      "todaysStars":"6 stars today"
   },
   {
      "index":23,
      "name":"Wox",
      "owner":"Wox-launcher",
      "description":"Launcher for Windows, an alternative to Alfred and Launchy.",
      "language":"C#",
      "allStars":"4,611",
      "todaysStars":"6 stars today"
   },
   {
      "index":24,
      "name":"msbuild",
      "owner":"Microsoft",
      "description":"The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio.",
      "language":"C#",
      "allStars":"2,852",
      "todaysStars":"5 stars today"
   }
]

Add build instructions

I tried to build the library but get several errors:

git clone https://github.com/rhysd/node-github-trend.git && cd node-github-trend && npm run build

src/lib.d.ts(1,22): error TS6053: File '/home/x/Git/node-github-trend/typings/tsd.d.ts' not found.
src/main.ts(1,26): error TS7016: Could not find a declaration file for module 'request'. '/home/x/Git/node-github-trend/node_modules/request/index.js' implicitly has an 'any' type.
  Try `npm install @types/request` if it exists or add a new declaration (.d.ts) file containing `declare module 'request';`
src/main.ts(2,26): error TS7016: Could not find a declaration file for module 'cheerio'. '/home/x/Git/node-github-trend/node_modules/cheerio/index.js' implicitly has an 'any' type.
  Try `npm install @types/cheerio` if it exists or add a new declaration (.d.ts) file containing `declare module 'cheerio';`
src/main.ts(3,23): error TS7016: Could not find a declaration file for module 'js-yaml'. '/home/x/Git/node-github-trend/node_modules/js-yaml/index.js' implicitly has an 'any' type.
  Try `npm install @types/js-yaml` if it exists or add a new declaration (.d.ts) file containing `declare module 'js-yaml';`
src/main.ts(66,20): error TS2693: 'Promise' only refers to a type, but is being used as a value here.
src/main.ts(66,29): error TS7006: Parameter 'resolve' implicitly has an 'any' type.
src/main.ts(66,38): error TS7006: Parameter 'reject' implicitly has an 'any' type.
src/main.ts(67,28): error TS7006: Parameter 'err' implicitly has an 'any' type.
src/main.ts(67,33): error TS7006: Parameter 'res' implicitly has an 'any' type.
src/main.ts(67,38): error TS7006: Parameter 'body' implicitly has an 'any' type.
src/main.ts(88,32): error TS7006: Parameter 'li' implicitly has an 'any' type.
src/main.ts(88,36): error TS7006: Parameter 'i' implicitly has an 'any' type.
src/main.ts(169,20): error TS2693: 'Promise' only refers to a type, but is being used as a value here.
src/main.ts(172,20): error TS2693: 'Promise' only refers to a type, but is being used as a value here.
src/main.ts(172,29): error TS7006: Parameter 'resolve' implicitly has an 'any' type.
src/main.ts(172,38): error TS7006: Parameter 'reject' implicitly has an 'any' type.
src/main.ts(181,28): error TS7006: Parameter 'err' implicitly has an 'any' type.
src/main.ts(181,33): error TS7006: Parameter 'res' implicitly has an 'any' type.
src/main.ts(181,38): error TS7006: Parameter 'body' implicitly has an 'any' type.
src/main.ts(248,20): error TS2693: 'Promise' only refers to a type, but is being used as a value here.
src/main.ts(248,29): error TS7006: Parameter 'resolve' implicitly has an 'any' type.
src/main.ts(248,38): error TS7006: Parameter 'reject' implicitly has an 'any' type.
src/main.ts(267,28): error TS7006: Parameter 'err' implicitly has an 'any' type.
src/main.ts(267,33): error TS7006: Parameter 'res' implicitly has an 'any' type.
src/main.ts(267,38): error TS7006: Parameter 'body' implicitly has an 'any' type.
src/main.ts(296,20): error TS2693: 'Promise' only refers to a type, but is being used as a value here.
src/main.ts(301,20): error TS2693: 'Promise' only refers to a type, but is being used as a value here.
src/main.ts(301,28): error TS7006: Parameter 'resolve' implicitly has an 'any' type.
src/main.ts(312,28): error TS7006: Parameter 'err' implicitly has an 'any' type.
src/main.ts(312,33): error TS7006: Parameter 'res' implicitly has an 'any' type.
src/main.ts(312,38): error TS7006: Parameter '_' implicitly has an 'any' type.
src/main.ts(335,20): error TS2693: 'Promise' only refers to a type, but is being used as a value here.
src/main.ts(346,16): error TS2693: 'Promise' only refers to a type, but is being used as a value here.
src/main.ts(363,16): error TS2693: 'Promise' only refers to a type, but is being used as a value here.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `tsc -p src/`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     /home/x/.npm/_logs/2017-09-10T13_27_54_833Z-debug.log

I also tried yarn global add tsd && tsd instadd && npm run build

node_modules/typescript/lib/lib.d.ts(1288,11): error TS2428: All declarations of 'Promise' must have identical type parameters.
node_modules/typescript/lib/lib.d.ts(1295,211): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(1302,112): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(5418,14): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(5438,124): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(5439,15): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(5445,16): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(5604,32): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(5605,38): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(5606,64): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(5608,63): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(5610,52): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(5619,32): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(5620,29): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(5622,63): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(5623,30): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(9852,13): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(9853,48): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(11401,56): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(11461,51): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(11470,22): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(11474,14): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(11475,59): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(11476,30): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(11477,15): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(11478,28): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(11500,24): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(11640,59): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(11773,52): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(11834,99): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(11835,103): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(12315,109): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(12475,67): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(12546,23): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(12547,35): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(12662,14): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(12663,13): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(12674,19): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(12690,41): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(13016,24): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(13017,61): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(13018,55): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(13031,20): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(13095,15): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(13105,15): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(13106,13): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(13331,132): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(13334,118): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(13335,144): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(13339,136): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(13342,144): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(13343,145): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(13449,17): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(13450,19): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(13597,21): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(13598,45): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(13600,68): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(13636,69): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(13637,19): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(13638,15): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(15661,28): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(16037,72): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(16038,160): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(17376,169): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(17377,217): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(17577,20): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(17578,13): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(17579,13): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(17580,13): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(17581,17): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(17722,52): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(18719,182): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(18720,230): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
node_modules/typescript/lib/lib.d.ts(18751,65): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
src/main.ts(85,33): error TS2339: Property 'load' does not exist on type 'typeof "cheerio"'.
src/main.ts(88,32): error TS7006: Parameter 'li' implicitly has an 'any' type.
src/main.ts(88,36): error TS7006: Parameter 'i' implicitly has an 'any' type.
src/main.ts(150,33): error TS2339: Property 'load' does not exist on type 'typeof "cheerio"'.
src/main.ts(292,27): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
src/main.ts(331,27): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
src/main.ts(340,23): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
src/main.ts(357,23): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
typings/es6-promise/es6-promise.d.ts(11,15): error TS2428: All declarations of 'Promise' must have identical type parameters.
typings/es6-promise/es6-promise.d.ts(31,105): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
typings/es6-promise/es6-promise.d.ts(32,94): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
typings/es6-promise/es6-promise.d.ts(39,58): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
typings/es6-promise/es6-promise.d.ts(47,48): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
typings/es6-promise/es6-promise.d.ts(52,31): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
typings/es6-promise/es6-promise.d.ts(59,50): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
typings/es6-promise/es6-promise.d.ts(64,51): error TS2314: Generic type 'Promise<T, R>' requires 2 type argument(s).
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `tsc -p src/`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/x/.npm/_logs/2017-09-10T13_38_17_409Z-debug.log

Maybe i do something wrong or miss something, but unfortunately there are no build instructions.

All stars and todays stars issue when comma in number

All stars and todays stars issue when comma in number.

Noticed an issue when numbers of stars is being parsed to an integer and commas (,) appear in the formatted number from the site.

for example
1,233 would end up parsed as 1
55,593 would end up parsed as 55

undefined for allStars and todays stars

I found that using "stargazers_count"
console.log(repo.stargazers_count);
i am able to get the number of stars.

I suggest checking the JQuery selector for,

  • all stars
  • today stars

Invalid status 403 for below code

Hi,

I am pretty sure the below code worked , but i am getting 403 error. Is there a limit to which i can call the api in a day?
Please help.
var http = require('http');
var Trending = require("github-trend");
//var scraper = new Trending.Scraper();
var client = new Trending.Client();
// Empty string means 'all languages'
client.fetchTrending("").then(function(repos){
repos.forEach(function(repo){
console.log(repo.owner+","+repo.name+","+repo.description+","+repo.language+","+repo.allStars);
});
}).catch(function(err){
console.log(err.message);
});

client.requestDefaults = 'https://myproxy.com:8087';

http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'})
res.end('');

}).listen(8087);

console.log('Server started on 8087');

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.