Fetching data from the internet
In this recipe, we will show how to use Julia to obtain data from the internet, and how to extract information from web pages. We will write some sample code that extracts the number of stars from GitHub projects.
Getting ready
For this recipe, you need the following packages:HTTP.jl
,Gumbo.jl
, andCascadia.jl
.These packages can simply be installed with the Julia package manager. In the Julia command line (REPL), simply press ] key and run the following commands:
(v1.0) pkg>addHTTP (v1.0) pkg>addGumbo (v1.0) pkg>addCascadia
Â
This will install the aforementioned packages and all their dependencies.
Note
In the GitHub repository for this recipe, you will find the commands.txt
file, which contains the presented sequence of Julia commands.
How to do it...
In this example, we will read the number of GitHub stars from a set of GitHub repositories present under the umbrella of the JuliaWeb organization:
- Start by loading the required modules as follows:
usingHTTP, Gumbo...