Created
August 28, 2016 02:30
-
-
Save xreiju/0f714da6e51b04c00a93654a3ede8730 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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