Jump to content

Four Word Game reader

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
15 replies to this topic

#1
Vswe

Vswe

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 9,552 posts
I just made a small program I want to share with you :) The program will look for all posts in the new "Four Word Game" and put them together to a whole story. The program is written in python and here's the code :D :


#Import urllib to be able to get the contents from the webpages
import urllib

#get the content of the page with the list of all posts
content = urllib.urlopen("http://forum.codecall.net/games/21449-four-word-game.html?mode=threaded").read()

#Create two variables
Index = 0
posts = []

#A while loop to find all posts
while "writeLink(" in (content[Index:]):

    #Get the number of the post
    Index = content.index("writeLink(",Index)
    Number = content[Index + len("writeLink("):content.index(",",Index)]  
    Index += 1
    
    #Save the post number for later
    posts+= [Number]


#Go through all posts
for post in posts:

    if "208731" == post: #First post
        print "once upon a time",
    else:
        #Get content of post
        content = urllib.urlopen("http://forum.codecall.net/" + post + "-post.html").read()

        #Get the startposition of the message
        Index = content.index('<div id="post_message_' + post + '">') 

        #Get the message
        message = content[Index + len('<div id="post_message_' + post + '">'):content.index("</div>",Index)]

        #Removes the note that the post is posted with CodeCall Mobile(if it is)
        message = message.replace('<i>Posted via <a href="http://codecall.mobi" target="_blank">CodeCall Mobile</a></i>',"")
        print message,



EDIT:

I have now also created a web version. It's faster and you don't need python installed :D It's located at: http://vswe.codecall.net/FourWord.php

Edited by Vswe, 09 October 2009 - 10:34 AM.


#2
marwex89

marwex89

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 10,720 posts
Great idea! I would +rep you but I need to spread some around.
Hey! Check out my new Toyota keyboaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

#3
Vswe

Vswe

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 9,552 posts
Hopefully people doesn't post something like this:

"and then they had

good part marwex btw"

because then it think all that is the message. :D

#4
marwex89

marwex89

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 10,720 posts
Haha, no we should put up a warning.. I bet people will post "This looks cool, I'll join.."
Hey! Check out my new Toyota keyboaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

#5
Vswe

Vswe

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 9,552 posts
But if we put up a warning it will be added too :P

#6
marwex89

marwex89

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 10,720 posts
Not if we add it to the first post.. And add "READ FIRST POST" in the title :D
Hey! Check out my new Toyota keyboaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

#7
Vswe

Vswe

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 9,552 posts
You're right :D

#8
Guest_Jordan_*

Guest_Jordan_*
  • Guests
Cool, how about a PHP version so we can read the whole story online? :amr:

#9
Vswe

Vswe

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 9,552 posts
That's a good idea! :amr:

#10
Vswe

Vswe

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 9,552 posts
I have now also created a web version. It's faster and you don't need python installed :D It's located at: http://vswe.codecall.net/FourWord.php

#11
marwex89

marwex89

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 10,720 posts
Great work Vswe!
Hey! Check out my new Toyota keyboaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

#12
Vswe

Vswe

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 9,552 posts
I just made every second message bold so you can see where it's a new message. Is that better or should I change back?