Skip to content

Commit

Permalink
disable contributions as client side rendered #132
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonic committed Apr 23, 2024
1 parent b79a4e9 commit e612c1c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
1 change: 1 addition & 0 deletions lib/org_repos.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ function org_repos($, url, callback) {
console.log($(parent))
console.log($(parent + ' .markdown-title'))
data.entries.push({
// feel free to add more attributes to this! 馃檹
name: $(parent + ' .markdown-title').text().trim(),
// lang: $(parent + ' .listview-item-main-content').find('[class^="Text-"]').text().trim(),
url: $(parent + ' a').first().attr('href'),
Expand Down
6 changes: 3 additions & 3 deletions lib/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ module.exports = function profile ($, url, callback) {
data.website = $('[data-test-selector=profile-website-url] > a').attr("href")
// data.joined = $('.join-date').attr('datetime'); // Joined GitHub

// Contributions to Open Source in the past 12 months
data.contribs = parseInt($('.js-yearly-contributions').text().trim()
.split(' contributions')[0].replace(',', ''), 10);
// Contributions to Open Source in the past 12 months #132
// data.contribs = parseInt($('.js-yearly-contributions h2').text().trim()
// .split(' contributions')[0].replace(',', ''), 10);
// Contribution Matrix
data = require('./profile_contribs.js')($, data);

Expand Down
3 changes: 0 additions & 3 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ function parse_int (str) {
, 10)
}

/**
* A library of utility functions for parsing web data.
*/
module.exports = {
parse_int: parse_int
}
10 changes: 5 additions & 5 deletions test/profile.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ test(file + 'Scrape @nelsonic GitHub profile (consistent state profile)', functi

t.ok(data.following > 300, '- @' + user
+ ' Is following more than 300 people');
t.ok(data.contribs > 3000, '- @' + user + ' Has made ' + data.contribs
+ ' contributions to Open Source this year!');
// t.ok(data.contribs > 3000, '- @' + user + ' Has made ' + data.contribs
// + ' contributions to Open Source this year!');

t.ok(data.pinned.length === 6, '- @' + user
+ ' Has Six "Pinned" Repositories');
Expand Down Expand Up @@ -60,9 +60,9 @@ test(file + 'Scrape @iteles detailed contribution matrix', function(t){
var user = 'iteles';
profile(user, function(err, data) {
t.ok(data.bio.match(/Co-founder/i), '- @' + user + ' bio: ' + data.bio);
t.ok(data.contribs > 100, '- @' + user + ' Has made ' + data.contribs
+ ' contributions to Open Source this year!');

// now client rendered so cannot parse! #132
// t.ok(data.contribs > 100, '- @' + user + ' Has made ' + data.contribs
// + ' contributions to Open Source this year!');
t.end();
});
});
Expand Down

0 comments on commit e612c1c

Please sign in to comment.