mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-23 10:34:19 +01:00
Improved the snarfer re and added the 'Buy It Now' price to the list of things
which are snarfed.
This commit is contained in:
parent
f57aba4c80
commit
dc9acab9b5
@ -99,6 +99,10 @@ class Ebay(callbacks.PrivmsgCommandAndRegexp):
|
||||
'Winning bidder'), self._winningBidder.search(s).group(1),
|
||||
self._winningBidder.search(s).group(2))
|
||||
|
||||
_buyNow = re.compile(r'alt="Buy It Now">.*?<b>([^<]+)</b>')
|
||||
_getBuynow = lambda self, s: '%s: %s' % (ircutils.bold('Buy It Now'),
|
||||
self._buyNow.search(s).group(1))
|
||||
|
||||
_seller = re.compile(r'Seller information.+?<a href[^>]+>([^<]+)</a>'\
|
||||
'.+ViewFeedback.+">(\d+)</a>', _reopts)
|
||||
_getSeller = lambda self, s: '%s: %s (%s)' % (ircutils.bold('Seller'),
|
||||
@ -135,8 +139,8 @@ class Ebay(callbacks.PrivmsgCommandAndRegexp):
|
||||
self._getResponse(irc, msg, url)
|
||||
|
||||
def ebaySnarfer(self, irc, msg, match):
|
||||
r"http://cgi\.ebay\.com/ws/eBayISAPI\.dll\?ViewItem&(?:item=\d+"\
|
||||
"(?:&category=\d+)?|category=\d+&item=\d+)"
|
||||
r"http://cgi\.ebay\.com/ws/eBayISAPI\.dll\?ViewItem(?:&item=\d+|"\
|
||||
"&category=\d+)+"
|
||||
if not self.snarfer:
|
||||
return
|
||||
url = match.group(0)
|
||||
@ -146,8 +150,9 @@ class Ebay(callbacks.PrivmsgCommandAndRegexp):
|
||||
fd = urllib2.urlopen(url)
|
||||
s = fd.read()
|
||||
fd.close()
|
||||
searches = (self._getBid, self._getWinningbid, self._getTime,
|
||||
self._getBidder, self._getWinningbidder, self._getSeller)
|
||||
searches = (self._getBid, self._getBuynow, self._getWinningbid,
|
||||
self._getTime, self._getBidder, self._getWinningbidder,
|
||||
self._getSeller)
|
||||
try:
|
||||
(num, desc) = self._info.search(s).groups()
|
||||
resp = ['%s%s: %s' % (ircutils.bold('Item #'), ircutils.bold(num),
|
||||
|
Loading…
Reference in New Issue
Block a user