Skip to content

Instantly share code, notes, and snippets.

@xreiju
Created August 28, 2016 02:30
Show Gist options
  • Save xreiju/0f714da6e51b04c00a93654a3ede8730 to your computer and use it in GitHub Desktop.
Save xreiju/0f714da6e51b04c00a93654a3ede8730 to your computer and use it in GitHub Desktop.
#!/usr/bin/rdmd
import std.regex;
import std.net.curl;
import std.stdio;
int main() {
char[] content;
try {
content = get("misskey.link");
} catch(Exception e) {
writeln("An error happened while getting the webpage.");
throw e;
}
auto r = ctRegex!("<meta name=\"csrf-token\" content=\"(.+?)\">");
foreach(c; matchAll(content, r))
writeln(c.hit, '\t');
writeln(matchFirst(content, r)[1]);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment