@ghuser/github-contribs
Advanced tools
Comparing version 2.2.3 to 2.2.4
50
index.js
@@ -86,35 +86,2 @@ 'use strict'; | ||
const getContribs = async (user, joinDate, since, until, ora, console, alsoIssues) => { | ||
const issuesHtmlToRepos = html => { | ||
const repos = new Set(); | ||
const handler = new htmlparser.DefaultHandler((error, dom) => {}); | ||
const parser = new htmlparser.Parser(handler); | ||
parser.parseComplete(html); | ||
for (let i = 0; i < handler.dom.length; ++i) { | ||
if (handler.dom[i].type === 'tag' && handler.dom[i].name === 'div') { | ||
const div1 = handler.dom[i].children; | ||
for (let j = 0; j < div1.length; ++j) { | ||
if (div1[j].type === 'tag' && div1[j].name === 'div') { | ||
const div2 = div1[j].children; | ||
for (let k = 0; k < div2.length; ++k) { | ||
if (div2[k].type === 'tag' && div2[k].name === 'button') { | ||
const button = div2[k].children; | ||
for (let l = 0; l < button.length; ++l) { | ||
if (button[l].type === 'tag' && button[l].name === 'span') { | ||
const span = button[l].children[0].data.trim(); | ||
if (span) { | ||
repos.add(span); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
return repos; | ||
}; | ||
const bigHtmlToRepos = (html, type) => { // type: 'issues', 'pull' or 'commits' | ||
@@ -181,15 +148,4 @@ const repos = new Set(); | ||
const prsRepos = bigHtmlToRepos(bigHtml, 'pull'); | ||
const issuesRepos = alsoIssues ? bigHtmlToRepos(bigHtml, 'issues') : []; | ||
let issuesRepos = []; | ||
let hotIssuesRepos = []; | ||
if (alsoIssues) { | ||
const userIssues = await fetchRetry( | ||
`https://github.com/users/${user}/created_issues?from=${currDateStr}&to=${currDateStr}`, | ||
); | ||
const userIssuesHtml = await userIssues.text(); | ||
issuesRepos = issuesHtmlToRepos(userIssuesHtml); | ||
hotIssuesRepos = bigHtmlToRepos(bigHtml, 'issues'); | ||
} | ||
progressSpinner.stop(); // temporary stop for logging | ||
@@ -208,6 +164,2 @@ for (const repo of commitsRepos) { | ||
} | ||
for (const repo of hotIssuesRepos) { | ||
console.log(`${currDateStr}: (hot issues) ${repo}`); | ||
result.add(repo); | ||
} | ||
progressSpinner.start( | ||
@@ -214,0 +166,0 @@ progressMsg(false, alsoIssues, ++numOfQueriedDays, numOfDaysToQuery) |
{ | ||
"name": "@ghuser/github-contribs", | ||
"version": "2.2.3", | ||
"version": "2.2.4", | ||
"description": "List all GitHub repos a user has contributed to since the beginning of time.", | ||
@@ -76,4 +76,4 @@ "license": "Unlicense", | ||
"check-coverage": true, | ||
"lines": 70 | ||
"lines": 75 | ||
} | ||
} |
@@ -6,3 +6,3 @@ [![Build Status](https://travis-ci.org/ghuser-io/github-contribs.svg?branch=master)](https://travis-ci.org/ghuser-io/github-contribs) | ||
[<img src="https://cdn.jsdelivr.net/gh/ghuser-io/github-contribs@b301e71d69531b0edf1befd1f865a70ced557014/thirdparty/octicons/repo.svg" align="left" width="64" height="64">](https://github.com/ghuser-io/github-contribs) | ||
[<img src="https://cdn.jsdelivr.net/gh/ghuser-io/github-contribs@51cced98637746769b8c7b0b8e84231b75893fde/thirdparty/octicons/repo.svg" align="left" width="64" height="64">](https://github.com/ghuser-io/github-contribs) | ||
@@ -71,44 +71,8 @@ # github-contribs | ||
Instead we noticed that the "Contribution Activity" on the | ||
[profile pages](https://github.com/AurelienLourot) queries such URLs in the background: | ||
Instead we noticed that the "Contribution Activity" section's content on the | ||
[profile pages](https://github.com/AurelienLourot) comes from URLs like | ||
https://github.com/AurelienLourot?from=2018-10-09 . | ||
* https://github.com/users/AurelienLourot/created_repositories?from=2018-05-17&to=2018-05-17 | ||
* https://github.com/users/AurelienLourot/created_pull_request_reviews?from=2018-05-17&to=2018-05-17 | ||
* https://github.com/users/AurelienLourot/created_issues?from=2018-07-10&to=2018-07-10 | ||
So we're fetching these URLs too and parsing their output. | ||
So we're doing the same :) | ||
> **NOTES**: | ||
> | ||
> * It seems like `created_issues` URLs don't deliver "hot issues" (issues which received | ||
> more comments than others): | ||
> | ||
> ```bash | ||
> $ curl -s "https://github.com/users/AurelienLourot/created_issues?from=2015-09-23&to=2015-09-23" | ||
> <div class="profile-rollup-content"> | ||
> </div> | ||
> ``` | ||
> | ||
> To get these, we also query the profile itself: | ||
> | ||
> ```bash | ||
> $ curl -s "https://github.com/AurelienLourot?from=2015-09-23" | grep issues/ | ||
> <a class="text-gray-dark" href="/jfrog/build-info/issues/60">Publish properties aren't used by build-info-extractor-gradle?</a> | ||
> ``` | ||
> | ||
> * In the past we used to get the pull requests from a `created_pull_requests` URL but this got | ||
> removed. We now get the pull requests from the profile itself as well: | ||
> | ||
> ```bash | ||
> $ curl -s "https://github.com/AurelienLourot?from=2017-08-28" | grep pull/ | ||
> <a href="/tt-gf/ant-ivy/pull/2" class="content-title no-underline"> | ||
> ``` | ||
> * Same now with `created_commits`: | ||
> | ||
> ```bash | ||
> $ curl -s "https://github.com/AurelienLourot?from=2017-08-27" | grep commits? | ||
> <a href="/AurelienLourot/mybeir.ut/commits?author=AurelienLourot&since=2017-08-27&until=2017-08-28" class="f6 muted-link ml-1"> | ||
> ``` | ||
### Why is it so slow? | ||
@@ -140,2 +104,6 @@ | ||
**2.2.4** (2018-11-11): | ||
* [ghuser-io/ghuser.io#172](https://github.com/ghuser-io/ghuser.io/issues/172) Fix after GitHub's | ||
interface has changed. The `created_issues` "endpoint" is gone. | ||
**2.2.3** (2018-10-20): | ||
@@ -142,0 +110,0 @@ * [ghuser-io/ghuser.io#172](https://github.com/ghuser-io/ghuser.io/issues/172) Fix after GitHub's |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17481
214
142