snipt

Ctrl+h for KB shortcuts

Python

penisify.py

import feedparser

def printDict(di, format="%-25s %s"):
    for (key, val) in di.items():
        print format % (str(key)+':', val)

rss = "http://pipes.yahoo.com/pipes/pipe.run?_id=08f3cfc2955ab60903bac0395783ef96&_render=rss"
feed = feedparser.parse(rss)

penisfile = open('tmp.html','wb')

penisfile.write('<ul>')
for entry in feed.entries:
    penisfile.write('<li>')
    penisfile.write('<a href="http://twitter.com/' + entry.author + '">' + entry.author + '</a> <a href="' + entry.links[0].href + '">said</a>: ' + entry.summary)
    penisfile.write('</li>')
penisfile.write("</ul>")

Description

This is the original source for twenis.com (aka twitterispenis.com). A prank site created by a coworker and myself in 2008-ish.
https://snipt.net/embed/7b2a5ccca5d1890f6819cd0e66190cc4/
/raw/7b2a5ccca5d1890f6819cd0e66190cc4/
7b2a5ccca5d1890f6819cd0e66190cc4
python
Python
17
2019-06-18T00:56:16
True
False
False
Apr 05, 2013 at 01:40 PM
/api/public/snipt/58840/
penisifypy
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1"> 1</a> <a href="#L-2"> 2</a> <a href="#L-3"> 3</a> <a href="#L-4"> 4</a> <a href="#L-5"> 5</a> <a href="#L-6"> 6</a> <a href="#L-7"> 7</a> <a href="#L-8"> 8</a> <a href="#L-9"> 9</a> <a href="#L-10">10</a> <a href="#L-11">11</a> <a href="#L-12">12</a> <a href="#L-13">13</a> <a href="#L-14">14</a> <a href="#L-15">15</a> <a href="#L-16">16</a> <a href="#L-17">17</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="kn">import</span> <span class="nn">feedparser</span> </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a><span class="k">def</span> <span class="nf">printDict</span><span class="p">(</span><span class="n">di</span><span class="p">,</span> <span class="n">format</span><span class="o">=</span><span class="s2">&quot;</span><span class="si">%-25s</span><span class="s2"> </span><span class="si">%s</span><span class="s2">&quot;</span><span class="p">):</span> </span><span id="L-4"><a name="L-4"></a> <span class="k">for</span> <span class="p">(</span><span class="n">key</span><span class="p">,</span> <span class="n">val</span><span class="p">)</span> <span class="ow">in</span> <span class="n">di</span><span class="o">.</span><span class="n">items</span><span class="p">():</span> </span><span id="L-5"><a name="L-5"></a> <span class="k">print</span> <span class="n">format</span> <span class="o">%</span> <span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">key</span><span class="p">)</span><span class="o">+</span><span class="s1">&#39;:&#39;</span><span class="p">,</span> <span class="n">val</span><span class="p">)</span> </span><span id="L-6"><a name="L-6"></a> </span><span id="L-7"><a name="L-7"></a><span class="n">rss</span> <span class="o">=</span> <span class="s2">&quot;http://pipes.yahoo.com/pipes/pipe.run?_id=08f3cfc2955ab60903bac0395783ef96&amp;_render=rss&quot;</span> </span><span id="L-8"><a name="L-8"></a><span class="n">feed</span> <span class="o">=</span> <span class="n">feedparser</span><span class="o">.</span><span class="n">parse</span><span class="p">(</span><span class="n">rss</span><span class="p">)</span> </span><span id="L-9"><a name="L-9"></a> </span><span id="L-10"><a name="L-10"></a><span class="n">penisfile</span> <span class="o">=</span> <span class="nb">open</span><span class="p">(</span><span class="s1">&#39;tmp.html&#39;</span><span class="p">,</span><span class="s1">&#39;wb&#39;</span><span class="p">)</span> </span><span id="L-11"><a name="L-11"></a> </span><span id="L-12"><a name="L-12"></a><span class="n">penisfile</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s1">&#39;&lt;ul&gt;&#39;</span><span class="p">)</span> </span><span id="L-13"><a name="L-13"></a><span class="k">for</span> <span class="n">entry</span> <span class="ow">in</span> <span class="n">feed</span><span class="o">.</span><span class="n">entries</span><span class="p">:</span> </span><span id="L-14"><a name="L-14"></a> <span class="n">penisfile</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s1">&#39;&lt;li&gt;&#39;</span><span class="p">)</span> </span><span id="L-15"><a name="L-15"></a> <span class="n">penisfile</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s1">&#39;&lt;a href=&quot;http://twitter.com/&#39;</span> <span class="o">+</span> <span class="n">entry</span><span class="o">.</span><span class="n">author</span> <span class="o">+</span> <span class="s1">&#39;&quot;&gt;&#39;</span> <span class="o">+</span> <span class="n">entry</span><span class="o">.</span><span class="n">author</span> <span class="o">+</span> <span class="s1">&#39;&lt;/a&gt; &lt;a href=&quot;&#39;</span> <span class="o">+</span> <span class="n">entry</span><span class="o">.</span><span class="n">links</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">href</span> <span class="o">+</span> <span class="s1">&#39;&quot;&gt;said&lt;/a&gt;: &#39;</span> <span class="o">+</span> <span class="n">entry</span><span class="o">.</span><span class="n">summary</span><span class="p">)</span> </span><span id="L-16"><a name="L-16"></a> <span class="n">penisfile</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s1">&#39;&lt;/li&gt;&#39;</span><span class="p">)</span> </span><span id="L-17"><a name="L-17"></a><span class="n">penisfile</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s2">&quot;&lt;/ul&gt;&quot;</span><span class="p">)</span> </span></pre></div> </td></tr></table>