Created
October 24, 2010 20:21
-
-
Save shabda/643959 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import urllib, simplejson | |
def is_github_project(href): | |
"Quick and dirty way to find if a link is a github project" | |
if href.startswith("http://github.com") and len(href.split("/")) == 5: | |
return True | |
return False | |
def get_popular_projects(): | |
yql_endpoint = "http://query.yahooapis.com/v1/public/yql?q=use%20'http%3A%2F%2Fyqlblog.net%2Fsamples%2Fdata.html.cssselect.xml'%20as%20data.html.cssselect%3B%20select%20*%20from%20data.html.cssselect%20where%20url%3D%22repopular.com%22%20and%20css%3D%22div.pad%20a%22&format=json&diagnostics=true&callback=" | |
data = urllib.urlopen(yql_endpoint).read() | |
repopular_json = simplejson.loads(data) | |
links = repopular_json["query"]["results"]["results"]["a"] | |
projects = set([link["href"] for link in links if "href" in link and is_github_project(link["href"])]) | |
return projects | |
if __name__ == "__main__": | |
popular_projects = get_popular_projects() | |
print popular_projects | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment