Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have discovered through my reading of XKCD that it feels funnier when viewed randomly. However, since I have read about 2/3 of the comics, that I am quickly getting into repetetive clicking of the random button to find a new one. So I'd like to find or build a tool that:

  • builds a list of all pages in a site (eg. xkcd.com/*)
  • removes pages from the list that are in firefox's history
  • randomly selects from the list of unviewed pages and redirects firefox to that page

So I think I could program a userscript to do this. But I'm not sure how to approach that.

A fact that I'm ignoring is XKCD (not to mention SMBC, Youtube, and others) offers RSS. If there was an RSS Reader that could download the feed from the beginning and randomly select from the ones which have not been viewed, that would be preferable because that limits the search to desirable content. What's your input? Know of any tools to do this?

share|improve this question

closed as too broad by Nifle, random Feb 12 at 23:19

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.If this question can be reworded to fit the rules in the help center, please edit the question.

    
What OS are you using? –  terdon Jun 26 '13 at 14:54
1  
stackoverflow.com/questions/9552403/… At least reading the history will probably not work from userscripts. –  Squeezy Jun 26 '13 at 15:50

1 Answer 1

up vote 2 down vote accepted

This is a general outline of how one might go about accomplishing this:

One very helpful fact about XKCD comics is that all of the URL's are in the form of

http://xkcd.com/####/

where #### is a number from 1 to 1230 (as of today)

Part I: Create a new random comic generator

  1. Creates a list of all numbers in that range
  2. Randomly chooses a number from the list
  3. Remove the number from the list
  4. Generate a url from the using the number picked

Now the trickier part -

Part II: Remove all the comics that you have already visited:

NOTE: This part is kind of convoluted, and not very portable - but hey it works.

  1. In Firefox - go to show all history
  2. Search for xkcd.com
  3. Drag all the links to a new bookmarks folder
  4. Export your bookmarks as html format
  5. Edit the html to remove all but the folder just created
  6. Loop through the file, and add all numbers found to a list.
  7. Subtract this list from the one in Part I

I realize I have glossed over lots of the details, but this should at least give you an idea of how to proceed. It seems like a fun little project - Good luck!

share|improve this answer
    
Yep, this tells me what I need to know, thanks. –  Champaigne Chips Jun 28 '13 at 1:50

Not the answer you're looking for? Browse other questions tagged or ask your own question.