In[]:=
req=HTTPRequest["https://api.github.com/search/repositories?page="<>ToString[1]<>"&q=coronavirus",<|"Headers"{"Authorization""token "<>token}|>]
Out[]=
HTTPRequest
In[]:=
response=URLRead[req]
Out[]=
HTTPResponse
In[]:=
ImportByteArray[response["BodyByteArray"],"RawJSON"]
In[]:=
i=1;more=True;result={};While[more,Pause[1];Echo[i];search=URLRead[HTTPRequest["https://api.github.com/search/repositories?page="<>ToString[i]<>"&q=coronavirus",<|"Headers"{"Authorization""token "<>token}|>]];json=ImportByteArray[search["BodyByteArray"],"RawJSON"];Echo[Length[json]];If[Length[json]=!=3,Abort[]];AppendTo[result,json["items"]];If[Length[json["items"]]>0,Null,more=False];i++];
»
1
»
3
»
2
»
3
»
3
»
3
»
4
»
3
»
5
»
3
»
6
»
3
»
7
»
3
»
8
»
3
»
9
»
3
»
10
»
3
»
11
»
3
»
12
»
3
»
13
»
3
»
14
»
3
In[]:=
1430
Out[]=
420
In[]:=
420-30
Out[]=
390
In[]:=
Length[Flatten[result]]
Out[]=
386
In[]:=
ds=Dataset[Map[<|"name"#["name"],"owner"#["owner"]["login"]|>&,Flatten[result]]]
Out[]=
In[]:=
gettags[assoc_]:=Module[{repo,owner,url,tags},repo=assoc["name"];owner=assoc["owner"];Echo[url=URL["https://api.github.com/repos/"<>owner<>"/"<>repo<>"/topics"]];tags=URLRead[HTTPRequest[url,<|"Headers"{"Accept""application/vnd.github.mercy-preview+json","Authorization""token "<>token}|>]];tags=ImportByteArray[tags["BodyByteArray"],"RawJSON"];<|"owner"owner,"repo"repo,"tags"tags["names"]|>]
In[]:=
Map[gettags,Take[ds,3]]
»
URL
»
URL
»
URL
Out[]=
In[]:=
result2=Map[gettags,ds];
»
URL
»
URL
»
URL
»
URL