Fix bug with page titles containing spaces
by URL encoding page names
This commit is contained in:
parent
1fcfb50ca3
commit
3c31925bc7
3
wp2git.d
3
wp2git.d
|
@ -4,6 +4,7 @@ import std.stream;
|
||||||
import std.string;
|
import std.string;
|
||||||
import std.file;
|
import std.file;
|
||||||
import std.conv;
|
import std.conv;
|
||||||
|
import std.uri;
|
||||||
import litexml;
|
import litexml;
|
||||||
|
|
||||||
int main(string[] args)
|
int main(string[] args)
|
||||||
|
@ -18,7 +19,7 @@ int main(string[] args)
|
||||||
if (name.length>=2 && name[0]=='"' && name[$-1]=='"')
|
if (name.length>=2 && name[0]=='"' && name[$-1]=='"')
|
||||||
name = name[1..$-1]; // strip quotes
|
name = name[1..$-1]; // strip quotes
|
||||||
|
|
||||||
if (spawnvp(P_WAIT, "curl", ["curl", "-d", "\"\"", "http://en.wikipedia.org/w/index.php?title=Special:Export&pages=" ~ name, "-o", "history.xml"]))
|
if (spawnvp(P_WAIT, "curl", ["curl", "-d", "\"\"", "http://en.wikipedia.org/w/index.php?title=Special:Export&pages=" ~ encodeComponent(name), "-o", "history.xml"]))
|
||||||
throw new Exception("curl error");
|
throw new Exception("curl error");
|
||||||
|
|
||||||
fwritefln(stderr, "Loading history...");
|
fwritefln(stderr, "Loading history...");
|
||||||
|
|
Loading…
Reference in New Issue