On GitHub, a user can have pinned repositories.
There's also the Repositories section of the API describing how to make requests that involve repos. You can also get information about the orgs a user is part of as described in another answer (which can be pinned).
However, I want to access a user's pinned repos. For example given the following profile:
I'd like to be able to do the following:
$ curl -s <some endpoint with some parameters> | <some pipeline with some filtering>
str
liffy_diffy
spiralify
micro-twitter
kit
xdoc
So I'm wondering:
- What is the endpoint and parameters do I need to get a user's pinned repos?
I was able to use the nokogiri gem to parse the html. However, it seems like I should be api to accomplish the same thing with a simple HTTP request:
$ ./get_user_pinned_repos mbigras
str
liffy_diffy
spiralify
micro-twitter
kit
xdoc
Code:
#!/usr/bin/env ruby
# get a user's pinned repos
require 'rubygems'
require 'nokogiri'
require 'open-uri'
if ARGV.length != 1
STDERR.puts "usage: get_user_pinned_repos <username>"
exit 1
end
username = ARGV.first
profile_url = "https://github.com/#{username}"
page = Nokogiri::HTML(open(profile_url))
page.css("span.repo").each { |repo| puts repo.text }