Created
November 24, 2018 18:48
-
-
Save mashingan/fc1a1fd6b40e49f3b81da9e30ad423ef to your computer and use it in GitHub Desktop.
Mangastream web-scrapper and download the manga for each chapter. Translation of downloadmanga.nim
This file contains hidden or 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
Red [] | |
get-image: function [url] [ | |
next-link: "" img-src: "" | |
parse read url [ | |
thru {<div class="page">} | |
thru {<a href="} | |
copy next-link to {">} | |
thru {src="} | |
copy img-src to {" } | |
] | |
if (next-link = "") or (img-src = "") [return none] | |
file: to file! last split img-src "/" | |
write/binary file read/binary to url! rejoin ["https:" img-src] | |
print ["downloaded" url "and written to" file] | |
to url! rejoin ["https://readms.net" next-link] | |
] | |
download-manga: function [url] [ | |
next-link: get-image url | |
while [next-link <> none] [ | |
next-link: get-image next-link | |
] | |
] | |
if any [system/options/args = none (length? system/options/args) < 1] [ | |
print "specify the url-path" | |
quit | |
] | |
download-manga to url! system/options/args/1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment