Before and now, I get this error:

$ ./spider http://static.arxiv.org/pdf/1109.4897.pdf
[Excepció: std.conv.ConvException@/usr/include/d2/4.6/std/conv.d(1640):
Can't convert value `HTT' of type string to type uint]

The code:

//D 2.0
//gdmd-4.6 <fitxer> => surt el fitxer amb el mateix nom i .o
//Usa https://github.com/Bystroushaak/DHTTPClient
import std.stdio, std.string, std.conv, std.stream;
import std.socket, std.socketstream;
import dhttpclient;

int main(string [] args)
{
    if (args.length < 2) {
                writeln("Usage:");
                writeln("   ./spider {<url1>, <url2>, ...}");
                return 0;
        }
        else {
                try {
                        string[string] capcalera = dhttpclient.FFHeaders;
                        //capcalera["User-Agent"] = "arachnida yottiuma";
                        HTTPClient navegador = new HTTPClient();
                        navegador.setClientHeaders(capcalera);

                        foreach (a; args[1..$]) {
                                writeln("[Contingut: ", cast(ubyte[]) 
navegador.get(a), "]");
                        }
                }
                catch (Exception e) {
                        writeln("[Excepció: ", e, "]");
                }
                return 0;
        }
}



What happens?


2012/1/20 Bystroushaak <bystrou...@kitakitsune.org>:
> It is unlimited, you just have to cast output to ubyte[]:
>
> std.file.write("logo3w.png", cast(ubyte[])
> cl.get("http://www.google.cz/images/srpr/logo3w.png";));
>
>

Reply via email to