Created
July 3, 2023 10:42
-
-
Save vimagick/0ca4e3d87369814522e65427c9ad532f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LET page = DOCUMENT("https://github.com/trending") | |
FOR row IN ELEMENTS(page, ".Box-row") | |
LET repo = LTRIM(ATTR_GET(ELEMENT(row, "h2>a"), "href").href, "/") | |
LET url = FMT("https://github.com/{}", repo) | |
LET desc = TRIM(FIRST(APPEND(INNER_TEXT_ALL(row, "p"), ""))) | |
LET lang = TRIM(FIRST(APPEND(INNER_TEXT_ALL(row, "span[itemprop='programmingLanguage']"), ""))) | |
LET stars = TO_INT(SUBSTITUTE(TRIM(INNER_TEXT(row, "a[href$='stargazers']")), ",", "")) | |
LET forks = TO_INT(SUBSTITUTE(TRIM(INNER_TEXT(row, "a[href$='forks']")), ",", "")) | |
LET users = ( | |
FOR u IN ELEMENTS(row, "a[data-hovercard-type='user']") | |
return LTRIM(ATTR_GET(u, "href").href, "/") | |
) | |
RETURN { url, repo, desc, lang, stars, forks, users } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Download ferret, and run:
ferret exec github-trending.fql