From dfd01567cba515e8ebe9e9adae7b983a88a9b804 Mon Sep 17 00:00:00 2001 From: JustAnotherArchivist Date: Sun, 7 Apr 2024 03:29:42 +0000 Subject: [PATCH] Fix org listings not including archived repos While the 'All' listing currently only excludes archived repos, this is a more general solution that, as long as they don't redesign the repository list yet again, should work even with further category display changes. --- github-list-repos | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/github-list-repos b/github-list-repos index 4ac522a..ab45060 100755 --- a/github-list-repos +++ b/github-list-repos @@ -1,4 +1,5 @@ #!/usr/bin/env python3 +import collections import html import logging import re @@ -47,7 +48,7 @@ def p(repoName): for user in users: r = get(f'https://github.com/{user}') if '
', r.text) if not musername: @@ -60,18 +61,30 @@ for user in users: print(html.unescape(musername.group(1).strip().replace('\n', ' ').replace('\r', ' '))) print(html.unescape(mfullname.group(1).strip().replace('\n', ' ').replace('\r', ' '))) sys.exit(0) - r = get(f'https://github.com/orgs/{user}/repositories') - page = 1 - while True: - for m in re.finditer(r']*\s)?data-hovercard-url="/([^/>"]+/[^/>"]+)/hovercard"', r.text): - p(m.group(1)) - for m in re.finditer(r']*\s)?href="/([^/>"]+/[^/>"]+)"', r.text): - p(m.group(1)) - if ']*\s)?href="/([^/>"]+/[^/>"]+)"', r.text): + maybe_p(m.group(1)) + if '