Skip to content

Commit 44d5a20

Browse files
committed
fix: update expr needed to get repo link
1 parent 42791cb commit 44d5a20

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

cmd/root.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,12 @@ func ParseRepos(r io.Reader) ([]Repository, error) {
161161
for _, article := range articleList {
162162
repo = &Repository{}
163163
// Href, RepoName
164-
hrefPath := htmlquery.SelectAttr(htmlquery.FindOne(article, "/h1/a"), "href")
164+
repoLinkNode := htmlquery.FindOne(article, "/h2/a")
165+
if repoLinkNode == nil {
166+
return nil, fmt.Errorf("repository link cannot be found")
167+
}
168+
169+
hrefPath := htmlquery.SelectAttr(repoLinkNode, "href")
165170
repo.Href = path.Join(githubURL, hrefPath)
166171
repoName := strings.Split(hrefPath, "/")
167172
repo.RepoName = repoName[1] + "/" + repoName[2]

0 commit comments

Comments
 (0)