Skip to content

Commit

Permalink
Merge pull request #15 from ShengQiBaoZao/ShengQiBaoZao-patch-1
Browse files Browse the repository at this point in the history
针对23-07-15更新了正则,并按字典序排序
  • Loading branch information
Zfour authored Aug 8, 2023
2 parents 02bd214 + 7b34571 commit cfd2f97
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions api/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@ def getdata(name):
gitpage = requests.get("https://github.com/" + name)
data = gitpage.text
datadatereg = re.compile(r'data-date="(.*?)" data-level')
datacountreg = re.compile(r'data-count="(.*?)" data-date')
datacountreg = re.compile(r'<span class="sr-only">(.*?) contribution')
datadate = datadatereg.findall(data)
datacount = datacountreg.findall(data)
datacount = list(map(int, datacount))
datacount = list(map(int, [0 if i == "No" else i for i in datacount]))

# 将datadate和datacount按照字典序排序
sorted_data = sorted(zip(datadate, datacount))
datadate, datacount = zip(*sorted_data)

contributions = sum(datacount)
datalist = []
for index, item in enumerate(datadate):
Expand Down

1 comment on commit cfd2f97

@vercel
Copy link

@vercel vercel bot commented on cfd2f97 Aug 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.