Created
November 13, 2023 17:35
-
-
Save EgorBo/1ba57768a198a6febe83514b33f8edcb to your computer and use it in GitHub Desktop.
blog-parser.cs
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
using System.Text.RegularExpressions; | |
string file = await new HttpClient().GetStringAsync( | |
"https://devblogs.microsoft.com/dotnet/performance-improvements-in-net-8/"); | |
MatchCollection pullRequestUrls = | |
Regex.Matches(file, @"https:\/\/github.com\/[a-zA-Z-]+\/[a-zA-Z-]+\/pull\/[0-9]+"); | |
int total = pullRequestUrls.Count; | |
int i = 1; | |
List<string> authors = new(); | |
foreach (var pullRequestUrl in pullRequestUrls.Select(m => m.ToString().Trim()).Distinct()) | |
{ | |
string content = await new HttpClient().GetStringAsync(pullRequestUrl); | |
string title = Regex.Match(content, @"<title>(.*?)<\/title>").Value | |
.Replace("<title>","") | |
.Replace("</title>", "") | |
.Trim(); | |
if (!title.Contains(" · Pull Request #")) | |
{ | |
// there are 6 links which are github issues rather than PRs despite /pull/ in the url | |
continue; | |
} | |
title = title.Substring(0, title.IndexOf(" · Pull Request #")); | |
string nick = title.Substring(title.LastIndexOf(" by ") + " by ".Length).Trim(); | |
Console.WriteLine($"{i++}/{total}: {title}"); | |
authors.Add(nick); | |
} | |
foreach (var author in authors.GroupBy(g => g).OrderByDescending(g => g.Count())) | |
{ | |
Console.WriteLine(author.Key.PadRight( | |
authors.Select(a => a.Length).Max() + 1) + " -- " + author.Count()); | |
} | |
/* | |
stephentoub -- 138 | |
EgorBo -- 63 | |
MihaZupan -- 37 | |
MichalStrehovsky -- 17 | |
jakobbotsch -- 13 | |
eiriktsarpalis -- 10 | |
AndyAyersMS -- 9 | |
TIHan -- 9 | |
wfurt -- 9 | |
adamsitnik -- 8 | |
tannergooding -- 7 | |
BrzVlad -- 7 | |
radekdoulik -- 7 | |
SwapnilGaikwad -- 6 | |
layomia -- 6 | |
DeepakRajendrakumaran -- 5 | |
kg -- 5 | |
buyaa-n -- 5 | |
kunalspathak -- 4 | |
jkotas -- 4 | |
VSadov -- 4 | |
tarekgh -- 4 | |
Daniel-Svensson -- 4 | |
brantburnett -- 4 | |
xtqqczze -- 4 | |
geeknoid -- 3 | |
pedrobsaila -- 3 | |
davidwrighton -- 3 | |
PeterSolMS -- 3 | |
kotlarmilos -- 3 | |
teo-tsirpanis -- 3 | |
lateapexearlyspeed -- 3 | |
MichalPetryka -- 3 | |
gfoidl -- 3 | |
yesmey -- 3 | |
xoofx -- 3 | |
vcsjones -- 3 | |
TrayanZapryanov -- 3 | |
anthonycanino -- 2 | |
khushal1996 -- 2 | |
a74nh -- 2 | |
eerhardt -- 2 | |
vargaz -- 2 | |
ilonatommy -- 2 | |
huoyaoyuan -- 2 | |
steveharter -- 2 | |
mla-alm -- 2 | |
jcouv -- 2 | |
alrz -- 2 | |
carlossanlop -- 2 | |
CollinAlpert -- 2 | |
mpidash -- 2 | |
Miizukii -- 2 | |
am11 -- 2 | |
bartonjs -- 2 | |
Poppyto -- 2 | |
marek-safar -- 1 | |
Ruihan-Yin -- 1 | |
jkrishnavs -- 1 | |
jjonescz -- 1 | |
SingleAccretion -- 1 | |
dubiousconst282 -- 1 | |
En3Tho -- 1 | |
AndyJGraham -- 1 | |
krwq -- 1 | |
JamesNK -- 1 | |
mkhamoyan -- 1 | |
eduardo-vp -- 1 | |
hrrrrustic -- 1 | |
github-actions[bot] -- 1 | |
mdh1418 -- 1 | |
BrennanConroy -- 1 | |
WeihanLi -- 1 | |
bollhals -- 1 | |
deeprobin -- 1 | |
jandupej -- 1 | |
sbomer -- 1 | |
AlekseyTs -- 1 | |
Youssef1313 -- 1 | |
mrahhal -- 1 | |
steveberdy -- 1 | |
madelson -- 1 | |
neon-sunset -- 1 | |
AustinWise -- 1 | |
Sergio0694 -- 1 | |
cston -- 1 | |
danmoseley -- 1 | |
hamarb123 -- 1 | |
AaronRobinsonMSFT -- 1 | |
fanyang-mono -- 1 | |
lambdageek -- 1 | |
antonfirsov -- 1 | |
pentp -- 1 | |
Jozkee -- 1 | |
GrabYourPitchforks -- 1 | |
benaadams -- 1 | |
davidfowl -- 1 | |
davmason -- 1 | |
n77y -- 1 | |
RikkiGibson -- 1 | |
jlennox -- 1 | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment