Skip to content

Commit

Permalink
Merge pull request #670 from felddy/bugfix/669
Browse files Browse the repository at this point in the history
Update get_license tool for new license page format
  • Loading branch information
felddy authored Apr 29, 2023
2 parents bd3a183 + 6a09a7e commit da985df
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/get_license.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,13 @@ async function fetchLicenses(username: string): Promise<string[]> {
const body = await response.text();
const $ = await cheerio.load(body);

const licenses: string[] = $("pre.key-code code")
const licenses: string[] = $("div.license label.copy input")
.map(function (this: cheerio.Element) {
return $(this).text().replace(/-/g, ""); // remove dashes
const value = $(this).attr("value");
return value ? value.replace(/-/g, "") : undefined; // remove dashes
})
.get();
.get()
.filter(Boolean);
return licenses;
}

Expand Down

0 comments on commit da985df

Please sign in to comment.