Download all xkcd comics in one go…specially for xkcd fans

Long time no blogging and again now with a new piece of code just for xkcd fans.. I am a big fan of it and love reading it when I get bored. This sunday I thought how good it would be to have all the comics on my hard drive however I had one little problem that is there were around 700 comics in all together and I had no patience to get them by right clicking it. So I decided to write a small snippit for it too and put it on my blog.

The pages in xkcd are in the format of http://xkcd/<some number>/. What I did was navigate through all the pages and extracted the link of the image using a simple regex. After extracting the hotlinks of the images, I downloaded them to a folder.

Get the code from here http://bit.ly/98UehY

Now compile the code using javac and run it using java. Please note that all the images would be stored in the directory in which the compiled script lies and yes make sure you have got a working internet connection. Once you start it sit back and relax.

My script with a little modification can be applied to a lot of other sites too like onemanga etc

Disclaimer : I dont know whether it is legal or illegal so if anyone has any objection towards my script please leave a comment saying so and citing proper references

Advertisements

A multithreaded Java chat client

Here is the code for a chat client which I made a few days back to get to know a little about sockets and threads. Please run the server file first and then the client. Change the server name from hawk (this is my computer name) to your server name.

You can download the code for client from here:

Client Code

You can download the code for sever from here

Server Code

Hope u like it 🙂