Last active
December 6, 2022 22:15
-
-
Save marccane/3d6403e5ef12b4218675e68548c768ff to your computer and use it in GitHub Desktop.
Dirty & ugly bash+curl+grep+cut+rev+xargs+python+tee+sort oneliner to extract github urls, extract the repo stars and sort them by number of stars
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
time curl -s https://raw.githubusercontent.com/wspace/corpus/main/README.md | | |
grep -Eo "\[GitHub\]\(https://github\.com[0-9a-zA-Z/#-~]+\)" | | |
cut -c 10- | rev | cut -c 2- | rev | | |
xargs -I % sh -c "echo -n %; wget -q -O /tmp/out.tmp %; python -c \"from lxml import etree;a=etree.HTML(open('/tmp/out.tmp').read()).xpath('//span[@class={0}Counter js-social-count{0}]'.format(chr(39)))[0].text;b=a.replace('.','').replace('k','00') if a.find('k')!=-1 else a;print(' '+b)\"" | | |
tee /dev/stderr | | |
sort -t ' ' -k2n |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment