Data update

This commit is contained in:
Ingy döt Net 2023-09-16 17:28:03 -07:00
parent 5af6d93694
commit 796d366b97
455 changed files with 7413 additions and 1900 deletions

View file

@ -9,32 +9,52 @@ class Program
{
static void Main(string[] args)
{
string get1 = new WebClient().DownloadString("http://www.rosettacode.org/w/api.php?action=query&list=categorymembers&cmtitle=Category:Programming_Languages&cmlimit=500&format=json");
string get2 = new WebClient().DownloadString("http://www.rosettacode.org/w/index.php?title=Special:Categories&limit=5000");
string get2 = new WebClient().DownloadString("http://www.rosettacode.org/w/index.php?"
+"title=Special:Categories&limit=5000"
);
ArrayList langs = new ArrayList();
Dictionary<string, int> qtdmbr = new Dictionary<string, int>();
MatchCollection match1 = new Regex("\"title\":\"Category:(.+?)\"").Matches(get1);
MatchCollection match2 = new Regex("title=\"Category:(.+?)\">.+?</a>[^(]*\\((\\d+) members\\)").Matches(get2);
string cmcontinue = "";
foreach (Match lang in match1) langs.Add(lang.Groups[1].Value);
do
{
string get1 = new WebClient().DownloadString("http://www.rosettacode.org/w/api.php?"
+"action=query&list=categorymembers"
+"&cmtitle=Category:Programming_Languages"
+"&cmlimit=500&format=json"
+cmcontinue
);
cmcontinue = "";
MatchCollection languageMatch = new Regex("\"title\":\"Category:(.+?)\"").Matches(get1);
MatchCollection cmcontinueMatch = new Regex("cmcontinue\":\"([a-z0-9A-Z|]*)\"").Matches(get1);
foreach (Match lang in languageMatch) langs.Add(lang.Groups[1].Value);
foreach (Match more in cmcontinueMatch) cmcontinue = "&cmcontinue=" + more.Groups[1].Value;
}
while( cmcontinue != "" );
MatchCollection match2 =
new Regex("title=\"Category:(.+?)\">.+?</a>[^(]*\\(([\\d,.]+) members\\)").Matches(get2);
foreach (Match match in match2)
{
if (langs.Contains(match.Groups[1].Value))
{
qtdmbr.Add(match.Groups[1].Value, Int32.Parse(match.Groups[2].Value));
qtdmbr.Add(match.Groups[1].Value, Int32.Parse(match.Groups[2].Value
.Replace(",",string.Empty)
.Replace(".",string.Empty)));
}
}
string[] test = qtdmbr.OrderByDescending(x => x.Value).Select(x => String.Format("{0,3} - {1}", x.Value, x.Key)).ToArray();
string[] test =
qtdmbr.OrderByDescending(x => x.Value).Select(x => String.Format("{0,4} {1}", x.Value, x.Key)).ToArray();
int count = 1;
foreach (string i in test)
{
Console.WriteLine("{0,3}. {1}", count, i);
Console.WriteLine("{0,4}: {1}", count, i);
count++;
}
}