Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import xml.etree.ElementTree as ET
- import urllib2, re
- tweets = []
- data = urllib2.urlopen('http://mspaintadventures.com/storyfiles/hs2/05260/levels/openbound/redBubbleText.xml').read()
- tree = ET.fromstring(data)
- for args in tree.iter('args'):
- tweets.extend(args.text.split('@dave_idle%alttextbox_twitter DAVE/_EBUBBLES:'))
- text = ""
- html = """<!doctype html>
- <html><head>
- <title>Openbound Dave_EBubbles</title>
- <style>
- @font-face { font-family: Sburb; src: url('http://mspaintadventures.com/storyfiles/hs2/05260/resources/openbound/fonts/cour.ttf'), url('http://mspaintadventures.com/storyfiles/hs2/05260/resources/openbound/fonts/cour.woff'); }
- body { font-size: 14px; font-weight: bold; font-family: Courier New, Courier, Sburb; }
- .tweet { float: left; margin: 10px 40px 10px 10px; position: relative; height: 470px; width: 700px; }
- .dave { top: 0px; left: -30px; position: absolute; z-index: 1; width: 380px; height: 470px; background: url('http://mspaintadventures.com/storyfiles/hs2/05260/resources/openbound/dialogs/dave_idle.png') no-repeat; }
- .words { top: 125px; left: 190px; position: absolute; z-index: 0; height: 325px; width: 537px; }
- .text { color: #e00707; padding: 30px 30px 50px 150px; height: 151px; width: 358px; background: url('http://mspaintadventures.com/storyfiles/hs2/05260/resources/openbound/interface/alttextbox_twitter.png'); }
- .hashtag { text-align: right; padding: 14px 5px; height: 27px; width: 527px; background: url('http://mspaintadventures.com/storyfiles/hs2/05260/resources/openbound/interface/hashtagbar.png'); }
- .hashtag a { display: inline-block; height: 26px; width: 30px; z-index: 2; }
- .spade { background: url('http://mspaintadventures.com/storyfiles/hs2/05260/resources/openbound/interface/icons_spade.png') no-repeat; }
- .heart { background: url('http://mspaintadventures.com/storyfiles/hs2/05260/resources/openbound/interface/icons_heart.png') no-repeat; }
- .rebubble { background: url('http://mspaintadventures.com/storyfiles/hs2/05260/resources/openbound/interface/icons_bub.png') no-repeat; }
- </style>
- </head><body>
- """
- id = 1
- template = '<div id="ebubble-%d" class="dave"></div><div class="words"><div class="text"><span>DAVE_EBUBBLES: %s</span></div><div class="hashtag"><a class="spade" title="Permalink" href="#ebubble-%d"></a><a class="heart" title="Permalink" href="#ebubble-%d"></a><a class="rebubble" title="Permalink" href="#ebubble-%d"></a></div></div></div>'
- for t in tweets:
- t = t.strip()
- if not t:
- continue
- html += '\t<div class="tweet">'
- html += template % (id, t, id, id, id)
- html += '</div>\n'
- text += "DAVE_EBUBBLES: %s\n" % t
- id += 1
- html += '</body></html>'
- with open("openbound_ebubble.html","w") as f:
- f.write(html)
- with open("openbound_ebubble.txt","w") as f:
- f.write(text)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement