Created
March 11, 2020 04:32
-
-
Save mkfsn/c7159cfc9c096104a3b1a91165efd3b7 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
from pyquery import PyQuery as pq | |
import requests | |
users = {} | |
resp = requests.get("https://github.com/tokyo-metropolitan-gov/covid19/pull/1055") | |
for i in pq(resp.text).find("a.author[data-hovercard-type="+'"user"'+"]"): | |
user = pq(i).text() | |
url = pq(i).attr('href') | |
if user not in users: | |
r = requests.get('https://api.github.com/users'+url).json() | |
try: | |
location = r["location"] | |
except: | |
print("raw:", r) | |
users[user] = {'count': 0, 'location': location} | |
users[user]['count']+=1 | |
for name, u in users.items(): | |
print ("%13s:\t%s %d" % (name, u['location'], u['count'])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment