Browse Source

scanner patch

fix: invalid check logic of rate limit
improve: cache expiration time
pull/537/head
Dr.Lt.Data 8 months ago
parent
commit
98b942b7f0
  1. 1
      extension-node-map.json
  2. 172
      github-stats.json
  3. 1
      node_db/new/extension-node-map.json
  4. 73
      scanner.py

1
extension-node-map.json

@ -1037,6 +1037,7 @@
[
"EmptyMotionData",
"ExportSMPLTo3DSoftware",
"Export_SMPLMultipleSubjects_To_3DSoftware",
"Human4D_Img2SMPL",
"Humans4DLoader",
"MotionCLIPTextEncode",

172
github-stats.json

@ -1,10 +1,10 @@
{
"https://github.com/ltdrdata/ComfyUI-Manager": {
"stars": 3189,
"last_update": "2024-04-01 15:43:47"
"stars": 3197,
"last_update": "2024-04-02 12:19:19"
},
"https://github.com/ltdrdata/ComfyUI-Impact-Pack": {
"stars": 1065,
"stars": 1066,
"last_update": "2024-04-02 05:15:17"
},
"https://github.com/ltdrdata/ComfyUI-Inspire-Pack": {
@ -20,7 +20,7 @@
"last_update": "2023-08-18 19:03:06"
},
"https://github.com/Fannovel16/comfyui_controlnet_aux": {
"stars": 1117,
"stars": 1118,
"last_update": "2024-04-01 18:25:56"
},
"https://github.com/Fannovel16/ComfyUI-Frame-Interpolation": {
@ -36,7 +36,7 @@
"last_update": "2024-04-01 16:39:58"
},
"https://github.com/Fannovel16/ComfyUI-Video-Matting": {
"stars": 107,
"stars": 108,
"last_update": "2024-02-12 13:57:45"
},
"https://github.com/BlenderNeko/ComfyUI_Cutoff": {
@ -60,7 +60,7 @@
"last_update": "2023-09-11 10:09:22"
},
"https://github.com/jags111/efficiency-nodes-comfyui": {
"stars": 471,
"stars": 472,
"last_update": "2024-03-25 13:41:14"
},
"https://github.com/jags111/ComfyUI_Jags_VectorMagic": {
@ -72,17 +72,13 @@
"last_update": "2023-12-27 16:47:20"
},
"https://github.com/Derfuu/Derfuu_ComfyUI_ModdedNodes": {
"stars": 230,
"stars": 231,
"last_update": "2024-03-30 03:58:20"
},
"https://github.com/paulo-coronado/comfy_clip_blip_node": {
"stars": 25,
"last_update": "2023-09-27 00:33:21"
},
"https://github.com/Davemane42/ComfyUI_Dave_CustomNode": {
"stars": 246,
"last_update": "2024-04-02 00:59:02"
},
"https://github.com/WASasquatch/was-node-suite-comfyui": {
"stars": 755,
"last_update": "2024-03-20 00:46:04"
@ -224,11 +220,11 @@
"last_update": "2024-02-29 09:53:46"
},
"https://github.com/pythongosssss/ComfyUI-WD14-Tagger": {
"stars": 267,
"stars": 268,
"last_update": "2024-03-15 14:36:17"
},
"https://github.com/pythongosssss/ComfyUI-Custom-Scripts": {
"stars": 999,
"stars": 1000,
"last_update": "2024-04-02 04:42:43"
},
"https://github.com/strimmlarn/ComfyUI_Strimmlarns_aesthetic_score": {
@ -236,7 +232,7 @@
"last_update": "2024-03-01 23:00:05"
},
"https://github.com/TinyTerra/ComfyUI_tinyterraNodes": {
"stars": 231,
"stars": 234,
"last_update": "2024-03-10 07:42:00"
},
"https://github.com/Jordach/comfy-plasma": {
@ -256,7 +252,7 @@
"last_update": "2024-03-25 07:05:23"
},
"https://github.com/ssitu/ComfyUI_UltimateSDUpscale": {
"stars": 485,
"stars": 487,
"last_update": "2024-03-30 17:18:43"
},
"https://github.com/ssitu/ComfyUI_restart_sampling": {
@ -340,7 +336,7 @@
"last_update": "2024-03-20 06:12:08"
},
"https://github.com/shiimizu/ComfyUI-TiledDiffusion": {
"stars": 120,
"stars": 121,
"last_update": "2024-02-19 10:44:28"
},
"https://github.com/ZaneA/ComfyUI-ImageReward": {
@ -356,11 +352,11 @@
"last_update": "2023-09-26 06:31:44"
},
"https://github.com/cubiq/ComfyUI_IPAdapter_plus": {
"stars": 1896,
"last_update": "2024-04-01 15:38:36"
"stars": 1907,
"last_update": "2024-04-02 11:32:17"
},
"https://github.com/cubiq/ComfyUI_InstantID": {
"stars": 596,
"stars": 600,
"last_update": "2024-03-29 19:27:42"
},
"https://github.com/cubiq/ComfyUI_FaceAnalysis": {
@ -440,7 +436,7 @@
"last_update": "2023-10-22 22:12:55"
},
"https://github.com/daxthin/DZ-FaceDetailer": {
"stars": 83,
"stars": 84,
"last_update": "2023-12-16 17:31:44"
},
"https://github.com/asagi4/comfyui-prompt-control": {
@ -448,7 +444,7 @@
"last_update": "2024-03-19 22:22:37"
},
"https://github.com/asagi4/ComfyUI-CADS": {
"stars": 23,
"stars": 24,
"last_update": "2024-03-25 00:35:48"
},
"https://github.com/asagi4/comfyui-utility-nodes": {
@ -476,7 +472,7 @@
"last_update": "2023-08-03 08:57:52"
},
"https://github.com/bash-j/mikey_nodes": {
"stars": 58,
"stars": 59,
"last_update": "2024-03-10 09:09:50"
},
"https://github.com/failfa-st/failfast-comfyui-extensions": {
@ -492,20 +488,20 @@
"last_update": "2024-03-28 23:02:54"
},
"https://github.com/Kosinkadink/ComfyUI-Advanced-ControlNet": {
"stars": 298,
"last_update": "2024-04-01 23:20:36"
"stars": 300,
"last_update": "2024-04-02 07:07:31"
},
"https://github.com/Kosinkadink/ComfyUI-AnimateDiff-Evolved": {
"stars": 1868,
"stars": 1874,
"last_update": "2024-03-29 11:22:34"
},
"https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite": {
"stars": 271,
"stars": 273,
"last_update": "2024-03-31 00:31:24"
},
"https://github.com/Gourieff/comfyui-reactor-node": {
"stars": 792,
"last_update": "2024-03-28 06:06:36"
"stars": 794,
"last_update": "2024-04-02 10:10:43"
},
"https://github.com/imb101/ComfyUI-FaceSwap": {
"stars": 28,
@ -528,7 +524,7 @@
"last_update": "2023-10-15 03:19:16"
},
"https://github.com/dimtoneff/ComfyUI-PixelArt-Detector": {
"stars": 135,
"stars": 137,
"last_update": "2024-01-07 03:29:57"
},
"https://github.com/hylarucoder/ComfyUI-Eagle-PNGInfo": {
@ -628,15 +624,15 @@
"last_update": "2024-02-12 07:46:02"
},
"https://github.com/rgthree/rgthree-comfy": {
"stars": 434,
"stars": 435,
"last_update": "2024-04-02 00:45:15"
},
"https://github.com/AIGODLIKE/AIGODLIKE-COMFYUI-TRANSLATION": {
"stars": 634,
"last_update": "2024-04-01 09:07:08"
"stars": 636,
"last_update": "2024-04-02 10:03:49"
},
"https://github.com/AIGODLIKE/AIGODLIKE-ComfyUI-Studio": {
"stars": 166,
"stars": 167,
"last_update": "2024-03-24 04:37:53"
},
"https://github.com/AIGODLIKE/ComfyUI-CUP": {
@ -712,7 +708,7 @@
"last_update": "2023-08-19 06:52:19"
},
"https://github.com/kohya-ss/ControlNet-LLLite-ComfyUI": {
"stars": 117,
"stars": 118,
"last_update": "2024-03-15 19:05:53"
},
"https://github.com/jjkramhoeft/ComfyUI-Jjk-Nodes": {
@ -756,7 +752,7 @@
"last_update": "2024-02-23 18:59:41"
},
"https://github.com/YOUR-WORST-TACO/ComfyUI-TacoNodes": {
"stars": 12,
"stars": 13,
"last_update": "2023-08-30 16:06:45"
},
"https://github.com/Lerc/canvas_tab": {
@ -780,7 +776,7 @@
"last_update": "2024-03-04 08:52:39"
},
"https://github.com/Acly/comfyui-inpaint-nodes": {
"stars": 234,
"stars": 237,
"last_update": "2024-03-24 16:00:17"
},
"https://github.com/picturesonpictures/comfy_PoP": {
@ -792,7 +788,7 @@
"last_update": "2023-12-21 19:36:51"
},
"https://github.com/alt-key-project/comfyui-dream-video-batches": {
"stars": 37,
"stars": 38,
"last_update": "2023-12-03 10:31:55"
},
"https://github.com/seanlynch/comfyui-optical-flow": {
@ -804,7 +800,7 @@
"last_update": "2023-09-26 14:56:04"
},
"https://github.com/ArtBot2023/CharacterFaceSwap": {
"stars": 46,
"stars": 47,
"last_update": "2023-10-25 04:29:40"
},
"https://github.com/mav-rik/facerestore_cf": {
@ -872,7 +868,7 @@
"last_update": "2024-01-23 17:12:45"
},
"https://github.com/cubiq/ComfyUI_essentials": {
"stars": 154,
"stars": 156,
"last_update": "2024-03-30 19:23:33"
},
"https://github.com/Clybius/ComfyUI-Latent-Modifiers": {
@ -936,7 +932,7 @@
"last_update": "2023-11-25 10:16:57"
},
"https://github.com/kijai/ComfyUI-Marigold": {
"stars": 293,
"stars": 294,
"last_update": "2024-04-01 22:48:01"
},
"https://github.com/kijai/ComfyUI-Geowizard": {
@ -960,7 +956,7 @@
"last_update": "2024-03-11 00:50:24"
},
"https://github.com/kijai/ComfyUI-SUPIR": {
"stars": 777,
"stars": 779,
"last_update": "2024-03-29 22:29:23"
},
"https://github.com/kijai/ComfyUI-DynamiCrafterWrapper": {
@ -1056,7 +1052,7 @@
"last_update": "2023-10-20 16:33:23"
},
"https://github.com/shadowcz007/comfyui-mixlab-nodes": {
"stars": 609,
"stars": 613,
"last_update": "2024-03-30 15:46:38"
},
"https://github.com/shadowcz007/comfyui-ultralytics-yolo": {
@ -1140,7 +1136,7 @@
"last_update": "2023-11-06 06:34:25"
},
"https://github.com/Trung0246/ComfyUI-0246": {
"stars": 82,
"stars": 83,
"last_update": "2024-03-10 08:42:04"
},
"https://github.com/fexli/fexli-util-node-comfyui": {
@ -1172,7 +1168,7 @@
"last_update": "2024-02-15 05:52:28"
},
"https://github.com/banodoco/steerable-motion": {
"stars": 400,
"stars": 401,
"last_update": "2024-03-30 12:10:00"
},
"https://github.com/gemell1/ComfyUI_GMIC": {
@ -1296,11 +1292,11 @@
"last_update": "2023-12-22 08:22:45"
},
"https://github.com/ZHO-ZHO-ZHO/ComfyUI-Gemini": {
"stars": 298,
"stars": 300,
"last_update": "2024-01-15 12:19:46"
},
"https://github.com/ZHO-ZHO-ZHO/comfyui-portrait-master-zh-cn": {
"stars": 1310,
"stars": 1311,
"last_update": "2023-12-23 07:08:46"
},
"https://github.com/ZHO-ZHO-ZHO/ComfyUI-Q-Align": {
@ -1308,7 +1304,7 @@
"last_update": "2024-01-03 15:22:13"
},
"https://github.com/ZHO-ZHO-ZHO/ComfyUI-InstantID": {
"stars": 1035,
"stars": 1036,
"last_update": "2024-03-23 06:33:03"
},
"https://github.com/ZHO-ZHO-ZHO/ComfyUI-PhotoMaker-ZHO": {
@ -1316,7 +1312,7 @@
"last_update": "2024-01-25 13:13:33"
},
"https://github.com/ZHO-ZHO-ZHO/ComfyUI-Qwen-VL-API": {
"stars": 152,
"stars": 154,
"last_update": "2024-03-12 10:32:47"
},
"https://github.com/ZHO-ZHO-ZHO/ComfyUI-SVD-ZHO": {
@ -1336,7 +1332,7 @@
"last_update": "2024-04-02 02:55:59"
},
"https://github.com/ZHO-ZHO-ZHO/ComfyUI-BRIA_AI-RMBG": {
"stars": 389,
"stars": 391,
"last_update": "2024-02-07 13:22:16"
},
"https://github.com/ZHO-ZHO-ZHO/ComfyUI-DepthFM": {
@ -1344,7 +1340,7 @@
"last_update": "2024-03-25 02:09:04"
},
"https://github.com/ZHO-ZHO-ZHO/ComfyUI-BiRefNet-ZHO": {
"stars": 40,
"stars": 45,
"last_update": "2024-04-01 13:35:54"
},
"https://github.com/kenjiqq/qq-nodes-comfyui": {
@ -1676,7 +1672,7 @@
"last_update": "2024-02-17 14:26:26"
},
"https://github.com/crystian/ComfyUI-Crystools": {
"stars": 308,
"stars": 310,
"last_update": "2024-03-27 16:59:44"
},
"https://github.com/crystian/ComfyUI-Crystools-save": {
@ -1736,7 +1732,7 @@
"last_update": "2024-03-24 19:03:45"
},
"https://github.com/flowtyone/ComfyUI-Flowty-TripoSR": {
"stars": 275,
"stars": 276,
"last_update": "2024-03-19 10:49:59"
},
"https://github.com/flowtyone/ComfyUI-Flowty-CRM": {
@ -1760,7 +1756,7 @@
"last_update": "2024-01-04 14:41:18"
},
"https://github.com/chaojie/ComfyUI-AniPortrait": {
"stars": 148,
"stars": 150,
"last_update": "2024-04-02 03:06:43"
},
"https://github.com/chaojie/ComfyUI-Img2Img-Turbo": {
@ -1788,7 +1784,7 @@
"last_update": "2024-02-24 10:02:51"
},
"https://github.com/chaojie/ComfyUI-DynamiCrafter": {
"stars": 69,
"stars": 70,
"last_update": "2024-03-16 19:08:28"
},
"https://github.com/chaojie/ComfyUI-Panda3d": {
@ -1844,11 +1840,11 @@
"last_update": "2024-01-14 04:23:09"
},
"https://github.com/MrForExample/ComfyUI-3D-Pack": {
"stars": 1257,
"stars": 1260,
"last_update": "2024-04-01 13:51:02"
},
"https://github.com/MrForExample/ComfyUI-AnimateAnyone-Evolved": {
"stars": 371,
"stars": 373,
"last_update": "2024-02-02 14:19:37"
},
"https://github.com/Hangover3832/ComfyUI-Hangover-Nodes": {
@ -1857,11 +1853,11 @@
},
"https://github.com/Hangover3832/ComfyUI-Hangover-Moondream": {
"stars": 19,
"last_update": "2024-03-31 17:08:35"
"last_update": "2024-04-02 12:43:57"
},
"https://github.com/Hangover3832/ComfyUI-Hangover-Recognize_Anything": {
"stars": 3,
"last_update": "2024-03-31 17:56:08"
"last_update": "2024-04-02 10:41:08"
},
"https://github.com/tzwm/comfyui-profiler": {
"stars": 27,
@ -1869,11 +1865,11 @@
},
"https://github.com/daniel-lewis-ab/ComfyUI-Llama": {
"stars": 19,
"last_update": "2024-03-19 22:59:53"
"last_update": "2024-04-02 06:33:08"
},
"https://github.com/daniel-lewis-ab/ComfyUI-TTS": {
"stars": 3,
"last_update": "2024-01-28 00:07:17"
"stars": 4,
"last_update": "2024-04-02 06:32:21"
},
"https://github.com/djbielejeski/a-person-mask-generator": {
"stars": 178,
@ -1892,7 +1888,7 @@
"last_update": "2024-01-09 08:33:02"
},
"https://github.com/AInseven/ComfyUI-fastblend": {
"stars": 74,
"stars": 75,
"last_update": "2024-02-26 16:17:27"
},
"https://github.com/HebelHuber/comfyui-enhanced-save-node": {
@ -2005,7 +2001,7 @@
},
"https://github.com/longgui0318/comfyui-oms-diffusion": {
"stars": 3,
"last_update": "2024-04-01 08:57:33"
"last_update": "2024-04-02 10:12:23"
},
"https://github.com/DimaChaichan/LAizypainter-Exporter-ComfyUI": {
"stars": 6,
@ -2036,7 +2032,7 @@
"last_update": "2024-03-26 11:46:29"
},
"https://github.com/gokayfem/ComfyUI-Dream-Interpreter": {
"stars": 45,
"stars": 46,
"last_update": "2024-03-24 22:26:17"
},
"https://github.com/gokayfem/ComfyUI-Depth-Visualization": {
@ -2076,7 +2072,7 @@
"last_update": "2024-01-27 15:25:00"
},
"https://github.com/mape/ComfyUI-mape-Helpers": {
"stars": 63,
"stars": 64,
"last_update": "2024-02-07 16:58:47"
},
"https://github.com/zhongpei/Comfyui_image2prompt": {
@ -2124,7 +2120,7 @@
"last_update": "2024-02-03 16:45:06"
},
"https://github.com/Chan-0312/ComfyUI-IPAnimate": {
"stars": 48,
"stars": 50,
"last_update": "2024-02-01 09:17:58"
},
"https://github.com/Chan-0312/ComfyUI-EasyDeforum": {
@ -2152,7 +2148,7 @@
"last_update": "2024-02-05 17:48:33"
},
"https://github.com/dfl/comfyui-tcd-scheduler": {
"stars": 50,
"stars": 51,
"last_update": "2024-03-24 18:29:56"
},
"https://github.com/MarkoCa1/ComfyUI_Segment_Mask": {
@ -2180,7 +2176,7 @@
"last_update": "2024-02-25 12:35:13"
},
"https://github.com/XmYx/deforum-comfy-nodes": {
"stars": 53,
"stars": 54,
"last_update": "2024-03-21 11:08:54"
},
"https://github.com/adbrasi/ComfyUI-TrashNodes-DownloadHuggingface": {
@ -2213,7 +2209,7 @@
},
"https://github.com/Mamaaaamooooo/batchImg-rembg-ComfyUI-nodes": {
"stars": 8,
"last_update": "2024-02-15 09:03:57"
"last_update": "2024-04-02 12:00:48"
},
"https://github.com/jordoh/ComfyUI-Deepface": {
"stars": 8,
@ -2233,7 +2229,7 @@
},
"https://github.com/yytdfc/ComfyUI-Bedrock": {
"stars": 4,
"last_update": "2024-02-28 05:48:49"
"last_update": "2024-04-02 09:26:29"
},
"https://github.com/mirabarukaso/ComfyUI_Mira": {
"stars": 5,
@ -2288,7 +2284,7 @@
"last_update": "2024-02-26 09:37:16"
},
"https://github.com/AuroBit/ComfyUI-OOTDiffusion": {
"stars": 214,
"stars": 218,
"last_update": "2024-03-26 02:44:57"
},
"https://github.com/AuroBit/ComfyUI-AnimateAnyone-reproduction": {
@ -2360,7 +2356,7 @@
"last_update": "2024-02-29 19:40:01"
},
"https://github.com/438443467/ComfyUI-GPT4V-Image-Captioner": {
"stars": 7,
"stars": 8,
"last_update": "2024-03-29 10:30:27"
},
"https://github.com/uetuluk/comfyui-webcam-node": {
@ -2368,7 +2364,7 @@
"last_update": "2024-03-01 07:25:27"
},
"https://github.com/huchenlei/ComfyUI-layerdiffuse": {
"stars": 944,
"stars": 947,
"last_update": "2024-03-09 21:16:31"
},
"https://github.com/huchenlei/ComfyUI_DanTagGen": {
@ -2380,11 +2376,11 @@
"last_update": "2024-03-31 23:55:42"
},
"https://github.com/nathannlu/ComfyUI-Cloud": {
"stars": 103,
"stars": 104,
"last_update": "2024-03-31 06:00:13"
},
"https://github.com/11dogzi/Comfyui-ergouzi-Nodes": {
"stars": 3,
"stars": 4,
"last_update": "2024-03-12 02:03:09"
},
"https://github.com/BXYMartin/ComfyUI-InstantIDUtils": {
@ -2456,11 +2452,11 @@
"last_update": "2024-03-09 00:02:47"
},
"https://github.com/ExponentialML/ComfyUI_Native_DynamiCrafter": {
"stars": 52,
"stars": 55,
"last_update": "2024-03-23 02:32:04"
},
"https://github.com/ExponentialML/ComfyUI_VisualStylePrompting": {
"stars": 191,
"stars": 193,
"last_update": "2024-03-31 23:38:23"
},
"https://github.com/angeloshredder/StableCascadeResizer": {
@ -2544,7 +2540,7 @@
"last_update": "2024-03-30 19:14:48"
},
"https://github.com/Seedsa/Fooocus_Nodes": {
"stars": 14,
"stars": 15,
"last_update": "2024-03-28 07:37:38"
},
"https://github.com/zhangp365/ComfyUI-utils-nodes": {
@ -2620,8 +2616,8 @@
"last_update": "2024-03-31 20:39:40"
},
"https://github.com/jiaxiangc/ComfyUI-ResAdapter": {
"stars": 178,
"last_update": "2024-04-01 03:35:41"
"stars": 192,
"last_update": "2024-04-02 09:49:53"
},
"https://github.com/ParisNeo/lollms_nodes_suite": {
"stars": 5,
@ -2636,8 +2632,8 @@
"last_update": "2024-04-01 19:53:42"
},
"https://github.com/frankchieng/ComfyUI_Aniportrait": {
"stars": 8,
"last_update": "2024-04-02 05:12:34"
"stars": 9,
"last_update": "2024-04-02 11:28:15"
},
"https://github.com/BlakeOne/ComfyUI-SchedulerMixer": {
"stars": 3,
@ -2659,8 +2655,16 @@
"stars": 0,
"last_update": "2024-04-01 01:32:04"
},
"https://github.com/kijai/ComfyUI-APISR": {
"stars": 41,
"last_update": "2024-04-01 21:37:50"
},
"https://github.com/DrMWeigand/ComfyUI_ColorImageDetection": {
"stars": 0,
"last_update": "2024-04-01 10:47:39"
},
"https://github.com/comfyanonymous/ComfyUI": {
"stars": 30438,
"last_update": "2024-04-01 22:09:26"
"stars": 30467,
"last_update": "2024-04-02 07:38:10"
}
}

1
node_db/new/extension-node-map.json

@ -1037,6 +1037,7 @@
[
"EmptyMotionData",
"ExportSMPLTo3DSoftware",
"Export_SMPLMultipleSubjects_To_3DSoftware",
"Human4D_Img2SMPL",
"Humans4DLoader",
"MotionCLIPTextEncode",

73
scanner.py

@ -237,37 +237,62 @@ def update_custom_nodes():
except FileNotFoundError:
pass
if g.rate_limiting_resettime-datetime.datetime.now().timestamp() <= 0:
def is_rate_limit_exceeded():
return g.rate_limiting[0] == 0
if is_rate_limit_exceeded():
print(f"GitHub API Rate Limit Exceeded: remained - {(g.rate_limiting_resettime - datetime.datetime.now().timestamp())/60:.2f} min")
else:
def renew_stat(url):
if is_rate_limit_exceeded():
return
# Parsing the URL
parsed_url = urlparse(url)
domain = parsed_url.netloc
path = parsed_url.path
path_parts = path.strip("/").split("/")
if len(path_parts) >= 2 and domain == "github.com":
owner_repo = "/".join(path_parts[-2:])
repo = g.get_repo(owner_repo)
last_update = repo.pushed_at.strftime("%Y-%m-%d %H:%M:%S") if repo.pushed_at else 'N/A'
github_stats[url] = {
"stars": repo.stargazers_count,
"last_update": last_update,
"cached_time": datetime.datetime.now().timestamp(),
}
with open(GITHUB_STATS_CACHE_FILENAME, 'w', encoding='utf-8') as file:
json.dump(github_stats, file, ensure_ascii=False, indent=4)
else:
print(f"Invalid URL format for GitHub repository: {url}")
# resolve unresolved urls
for url, title, preemptions, node_pattern in git_url_titles_preemptions:
if url not in github_stats:
# Parsing the URL
parsed_url = urlparse(url)
domain = parsed_url.netloc
path = parsed_url.path
path_parts = path.strip("/").split("/")
if len(path_parts) >= 2 and domain == "github.com":
owner_repo = "/".join(path_parts[-2:])
repo = g.get_repo(owner_repo)
last_update = repo.pushed_at.strftime("%Y-%m-%d %H:%M:%S") if repo.pushed_at else 'N/A'
github_stats[url] = {
"stars": repo.stargazers_count,
"last_update": last_update,
}
with open(GITHUB_STATS_CACHE_FILENAME, 'w', encoding='utf-8') as file:
json.dump(github_stats, file, ensure_ascii=False, indent=4)
# print(f"Title: {title}, Stars: {repo.stargazers_count}, Last Update: {last_update}")
else:
print(f"Invalid URL format for GitHub repository: {url}")
renew_stat(url)
# renew outdated cache
outdated_urls = []
for k, v in github_stats.items():
if (datetime.datetime.now().timestamp() - v['cached_time']) > 60*60*3: # 3 hours
outdated_urls += k
for url in outdated_urls:
renew_stat(url)
with open(GITHUB_STATS_FILENAME, 'w', encoding='utf-8') as file:
for v in github_stats.values():
if "cached_time" in v:
del v["cached_time"]
json.dump(github_stats, file, ensure_ascii=False, indent=4)
print(f"Successfully written to {GITHUB_STATS_FILENAME}, removing {GITHUB_STATS_CACHE_FILENAME}.")
try:
os.remove(GITHUB_STATS_CACHE_FILENAME) # This cache file is just for avoiding failure of GitHub API fetch, so it is safe to remove.
except:
pass
# try:
# os.remove(GITHUB_STATS_CACHE_FILENAME) # This cache file is just for avoiding failure of GitHub API fetch, so it is safe to remove.
# except:
# pass
with concurrent.futures.ThreadPoolExecutor(11) as executor:
executor.submit(process_git_stats, git_url_titles_preemptions) # One single thread for `process_git_stats()`. Runs concurrently with `process_git_url_title()`.

Loading…
Cancel
Save