Index: bashorg_plugin.py =================================================================== --- bashorg_plugin.py (revision 143) +++ bashorg_plugin.py (working copy) @@ -24,16 +24,15 @@ def handler_bashorgru_get(type, source, parameters): if parameters.strip()=='': - req = urllib2.Request('http://bash.org.ru/quote.php') + req = urllib2.Request('http://bash.org.ru/random') else: - req = urllib2.Request('http://bash.org.ru/quote.php?num='+parameters.strip()) + req = urllib2.Request('http://bash.org.ru/search?text='+parameters.strip()) req.add_header = ('User-agent', 'Mozilla/5.0') try: r = urllib2.urlopen(req) target = r.read() - od = re.search('<td class="dat">',target) - message = target[od.end():] - message = message[:re.search('</td>',message).start()] + od = re.search(r'<div class="q">.*?<div class="vote">.*?</div>.*?<div>(.*?)</div>.*?</div>', target, re.DOTALL) + message = od.group(1) message = decode(message) message = '\n' + message.strip() smsg(type,source,unicode(message,'windows-1251'))
New patch version
New patch version, with some fixes:
Thanks, patch committed to
Thanks, patch committed to Neutron trunk SVN.