Commits

Benoit Boissinot committed d93238c

fix tfln and qdb

Comments (0)

Files changed (1)

             irc.error(str(e))
 
     _joiner = ' // '
-    _tflnReString = r'<div class="post_wrap" id="entry_(?P<id>\d+)">.*?'\
-                    r'<div class="post_content">(?P<text>.*?)</div>.*?'\
-                    r'<span id="postingGoodCount_.*?">(?P<up>\d+)</span>.*?'\
-                    r'<span id="postingBadCount_.*?">(?P<down>\d+)</span>'
+    _tflnReString = r'<textarea readonly="readonly">(?P<text>.*?) http://tfl.nu/[^<]*?</textarea>.*?'\
+                    r'<a class="good-night" id="P-(?P<id>\d+)".*?>Good night <span>\((?P<up>\d+)\)</span>.*?'\
+                    r'<a class="bad-night" id="N-\d+".*?>Bad night <span>\((?P<down>\d+)\)</span>'
     _mliaReString = r'<div id="s_(?P<id>\d+)" class="story s">\s*'\
                     r'<div class="sc">(?P<text>.*?)</div>.*?'\
                     r'<span class="v_pos">(?P<up>\d+)</span>.*?'\
                     r'<span class="v_neg">(?P<down>\d+)</span>'
-    _qdbReString = r'<tr><td bgcolor="#(?:ffffff|e8e8e8)"><a href="/\d*?">'\
-                    r'#\d*?</a>.*?<p>(?P<text>.*?)</p></td></tr>'
+    _qdbReString =  r'<span class=qt id=qt\d+>(?P<text>.*?)</span>'
     _gkREDict = {'bash.org': re.compile(r'<p class="qt">(?P<text>.*?)</p>',
                     re.M | re.DOTALL),
                 'qdb.us': re.compile(_qdbReString, re.M | re.DOTALL),
                 lang = 'en'
             url = self._betacieUrl % {'id': id, 'lang': lang}
         elif site == 'textsfromlastnight.com':
-            url = 'http://%s/%s%s' % (site,
-                                      not random and 'view/' or '',
-                                      id)
+            if random:
+                page = 'Random-Texts-From-Last-Night.html'
+            else:
+                page = 'Text-Replies-%s.html' % id
+            url = 'http://textsfromlastnight.com/%s' % page
         elif site == 'mylifeisaverage.com':
             if random:
                 url = 'http://%s/' % site
                 else:
                     break
         if not s:
+	    #self.log.info('server returned the string: %s', repr(html))
             return format('Could not find a quote for id %i.', id)
         else:
             if random: