May 04, 2019 [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;
}
| ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply