Skip to content

Commit

Permalink
Update to v0.9.2
Browse files Browse the repository at this point in the history
  • Loading branch information
HubTou authored May 19, 2024
1 parent b8c8d05 commit 2c9d690
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 32 deletions.
2 changes: 1 addition & 1 deletion LIBGH.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ To be tested under Windows.
## HISTORY
This implementation was made for the [PNU project](https://github.com/HubTou/PNU).

It's intended as the scraping engine for another tool.
It's intended as the scraping engine for my [topgh](https://github.com/HubTou/topgh) tool.

## LICENSE
It is available under the [3-clause BSD license](https://opensource.org/licenses/BSD-3-Clause).
Expand Down
2 changes: 1 addition & 1 deletion LIBGH.3.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ To be tested under Windows.
## HISTORY
This implementation was made for the [PNU project](https://github.com/HubTou/PNU).

It's intended as the scraping engine for another tool.
It's intended as the scraping engine for my [topgh](https://github.com/HubTou/topgh) tool.

## LICENSE
This library is available under the [3-clause BSD license](https://opensource.org/licenses/BSD-3-Clause).
Expand Down
6 changes: 4 additions & 2 deletions man/libgh.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.Dd May 18, 2024
.Dd May 19, 2024
.Dt LIBGH 1
.Os
.Sh NAME
Expand Down Expand Up @@ -179,7 +179,9 @@ To be tested under Windows.
This implementation was made for the
.Lk https://github.com/HubTou/PNU PNU project
.Pp
It's intended as the scraping engine for another tool.
It's intended as the scraping engine for my
.Lk https://github.com/HubTou/topgh topgh
tool.
.Sh LICENSE
It is available under the 3\-clause BSD license.
.Sh AUTHORS
Expand Down
6 changes: 4 additions & 2 deletions man/libgh.3
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.Dd May 7, 2024
.Dd May 19, 2024
.Dt LIBGH 3
.Os
.Sh NAME
Expand Down Expand Up @@ -251,7 +251,9 @@ To be tested under Windows.
This library was made for the
.Lk https://github.com/HubTou/PNU PNU project
.Pp
It's intended as the scraping engine for another tool.
It's intended as the scraping engine for my
.Lk https://github.com/HubTou/topgh topgh
tool.
.Sh LICENSE
This library is available under the 3\-clause BSD license.
.Sh AUTHORS
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = pnu-libgh
description = GitHub scraping library and tool
long_description = file: README.md
long_description_content_type = text/markdown
version = 0.9.1
version = 0.9.2
license = BSD 3-Clause License
license_files = LICENSe
author = Hubert Tournier
Expand Down
2 changes: 1 addition & 1 deletion src/libgh/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from .libpnu2 import get_url_bdata, get_url_data, prune_cache, collection2xml

# Version string used by the what(1) and ident(1) commands:
ID = "@(#) $Id: libgh - GitHub scraping tool v0.9.1 (May 18, 2024) by Hubert Tournier $"
ID = "@(#) $Id: libgh - GitHub scraping tool v0.9.2 (May 19, 2024) by Hubert Tournier $"

# Default parameters. Can be overcome by environment variables, then command line options
parameters = {
Expand Down
48 changes: 26 additions & 22 deletions src/libgh/organization_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,27 +215,30 @@ def load_org_account(account_name, soup, cache_days, force_fetch=False, complete
# repositories
account["repositories"] = {}
html = soup.select_one('[data-autosearch-results]')
number = html.text.split()[3]
try:
account["repositories_count"] = int(number)
except ValueError:
pass
account["repositories"] = load_org_repositories(
account_name,
cache_days,
force_fetch=force_fetch,
complete=complete
)
if len(account["repositories"]) != account["repositories_count"]:
account["repositories"].update(
load_org_repositories(
account_name,
cache_days,
force_fetch=force_fetch,
complete=complete,
repos_type="archived"
)
if html is not None:
number = html.text.split()[3]
try:
account["repositories_count"] = int(number)
except ValueError:
pass
account["repositories"] = load_org_repositories(
account_name,
cache_days,
force_fetch=force_fetch,
complete=complete
)
if len(account["repositories"]) != account["repositories_count"]:
account["repositories"].update(
load_org_repositories(
account_name,
cache_days,
force_fetch=force_fetch,
complete=complete,
repos_type="archived"
)
)
else:
account["repositories_count"] = 0

# repositories stars (computed)
stars = 0
Expand Down Expand Up @@ -279,9 +282,10 @@ def load_org_account(account_name, soup, cache_days, force_fetch=False, complete

if len(account["repositories"]) != account["repositories_count"]:
logging.warning(
"libgh: Loaded %d/%d repositories",
"libgh: Loaded %d/%d repositories for account '%s'",
len(account["repositories"]),
account["repositories_count"]
account["repositories_count"],
account_name
)

return account
5 changes: 3 additions & 2 deletions src/libgh/personal_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,10 @@ def load_user_account(account_name, soup, cache_days, force_fetch=False, complet

if len(account["repositories"]) != account["repositories_count"]:
logging.warning(
"libgh: Loaded %d/%d repositories",
"libgh: Loaded %d/%d repositories for account '%s'",
len(account["repositories"]),
account["repositories_count"]
account["repositories_count"],
account_name
)

return account

0 comments on commit 2c9d690

Please sign in to comment.