From 9954856d2b19a77010d1e193401e4de42abf8ce5 Mon Sep 17 00:00:00 2001 From: Ariasaka <66897357+LYXOfficial@users.noreply.github.com> Date: Fri, 15 Mar 2024 21:34:28 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D2023-11=E6=AD=A3=E5=88=99?= =?UTF-8?q?=E6=9B=B4=E6=94=B9+=E5=8E=9F=E6=A0=BC=E5=BC=8F=E4=B8=8D?= =?UTF-8?q?=E6=A0=87=E5=87=86=E4=BD=BFvercel=E8=87=AA=E5=8A=A8=E5=8A=A0?= =?UTF-8?q?=E7=AD=89=E5=8F=B7=E5=AF=BC=E8=87=B4api=E5=A4=B1=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/index.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/api/index.py b/api/index.py index ea585ee..26eaef2 100644 --- a/api/index.py +++ b/api/index.py @@ -1,7 +1,6 @@ -# -*- coding: UTF-8 -*- import requests import re -from http.server import BaseHTTPRequestHandler +from http.server import BaseHTTPRequestHandler,HTTPServer import json def list_split(items, n): @@ -9,8 +8,8 @@ def list_split(items, n): 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'(.*?) contribution') + datadatereg = re.compile(r'data-date="(.*?)" id="contribution-day-component') + datacountreg = re.compile(r'position-absolute">(.*?) contribution') datadate = datadatereg.findall(data) datacount = datacountreg.findall(data) datacount = list(map(int, [0 if i == "No" else i for i in datacount])) @@ -33,7 +32,7 @@ def getdata(name): class handler(BaseHTTPRequestHandler): def do_GET(self): path = self.path - user = path.split('?')[1] + user = path.split('?')[1][:-1] data = getdata(user) self.send_response(200) self.send_header('Access-Control-Allow-Origin', '*') From 3321e25fa891e6fe7f8a0a818f8b61fd9c9ef8c3 Mon Sep 17 00:00:00 2001 From: Ariasaka <66897357+LYXOfficial@users.noreply.github.com> Date: Fri, 15 Mar 2024 21:40:33 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D2023-11=E6=AD=A3=E5=88=99?= =?UTF-8?q?=E6=9B=B4=E6=94=B9=E5=92=8C=E5=8E=9F=E6=A0=BC=E5=BC=8F=E4=B8=8D?= =?UTF-8?q?=E6=A0=87=E5=87=86=E4=BD=BFvercel=E8=87=AA=E5=8A=A8=E5=8A=A0?= =?UTF-8?q?=E7=AD=89=E5=8F=B7=E5=AF=BC=E8=87=B4api=E5=A4=B1=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/index.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/index.py b/api/index.py index 26eaef2..fb3248e 100644 --- a/api/index.py +++ b/api/index.py @@ -1,6 +1,6 @@ import requests import re -from http.server import BaseHTTPRequestHandler,HTTPServer +from http.server import BaseHTTPRequestHandler import json def list_split(items, n):