57 lines
1.6 KiB
Plaintext
57 lines
1.6 KiB
Plaintext
;Uses a web scraping method.
|
|
|
|
;It is limited to only retrieving 5000 language categories and the counts contain
|
|
;some slight inaccuracies.
|
|
|
|
Structure Language
|
|
count.i
|
|
Name.s
|
|
EndStructure
|
|
|
|
Dim Row.Language(5000)
|
|
|
|
Procedure handleError(value, msg.s)
|
|
If value = 0
|
|
MessageRequester("Error", msg)
|
|
End
|
|
EndIf
|
|
EndProcedure
|
|
|
|
handleError(InitNetwork(), "Unable to initialize network functions.")
|
|
; Lines have been split to fit RC's 80 char preferences
|
|
ignore$ = "Basic language learning Encyclopedia Implementations " +
|
|
"Language Implementations Language users " +
|
|
"Maintenance/OmitCategoriesCreated Programming Languages " +
|
|
"Programming Tasks RCTemplates Solutions by Library Solutions by " +
|
|
"Programming Language Solutions by Programming Task Unimplemented " +
|
|
"tasks by language WikiStubs Examples needing attention " +
|
|
"Impl needed"
|
|
|
|
url$ = "http://www.rosettacode.org/mw/index.php?" +
|
|
"title=Special:Categories&limit=5000"
|
|
|
|
ReceiveHTTPFile(url$, "special.htm")
|
|
ReadFile(0, "special.htm", #PB_UTF8)
|
|
While Not Eof(0)
|
|
i + 1
|
|
x1$ = ReadString(0)
|
|
x2$ = Mid(x1$, FindString(x1$, "member", 1) - 4 , 3)
|
|
Row(i)\count = Val(Trim(RemoveString(x2$, "(")))
|
|
|
|
x3$ = Mid(x1$, FindString(x1$, Chr(34) + ">", 1) + 2, 30)
|
|
Row(i)\Name = Left(x3$, FindString(x3$, "<", 1) - 1)
|
|
If FindString(ignore$, Row(i)\Name, 1) Or Row(i)\Name = ""
|
|
Row(i)\count = 0
|
|
EndIf
|
|
Wend
|
|
|
|
|
|
|
|
offset=OffsetOf(Language\count)
|
|
SortStructuredArray(Row(), #PB_Sort_Descending, offset, #PB_Integer)
|
|
OpenConsole()
|
|
For i = 0 To 29
|
|
PrintN( Str(i + 1) + ". " + Str(Row(i)\count) + " - " + Row(i)\Name)
|
|
Next
|
|
Input()
|