www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - [your code here]

string weather(float latitude, float longitude)
{
     import std.regex;
     import std.net.curl;
     import std.format;
     import std.conv;

     auto r = regex(q{<span class="summary swap">(.+)</span>});

     foreach (line; 
byLine(format("https://darksky.net/forecast/%f,%f/ca24/en", 
latitude, longitude)))
         foreach (c; matchAll(line, r))
             return c[1].to!string;

     return "bug";
}

void main()
{
     import std.stdio;
     weather(52.517, 13.3889).writeln;
}
May 03 2019