Skip to content

Instantly share code, notes, and snippets.

Last active March 9, 2019 14:52
Show Gist options
  • Save bukowa/f339a9416f4a50635bd9983234114ae3 to your computer and use it in GitHub Desktop.
Save bukowa/f339a9416f4a50635bd9983234114ae3 to your computer and use it in GitHub Desktop.
path of exile check
from dataclasses import dataclass
from bs4 import BeautifulSoup as soup
import requests
from collections import Counter
import time
# python 3.7
# installation:
# pip install bs4 lxml requests
class Bot:
def __init__(self, url):
self.url = url
self.parser = soup(self._get_html(), 'lxml')
def _get_count(data):
cnt = Counter()
for i, v in enumerate(data):
cnt[v] += 1
return cnt
def _get_html(self, url=None):
return requests.get(url or self.url).content
def _get_all_ign(self):
return [
for e in
self.parser.findAll('span', 'success label')
def parse(self):
return self._get_count(self._get_all_ign())
class Item:
name: str
price: int
currency: str
url: str
description: str = ''
def __post_init__(self): = Bot(self.url)
def get_message(self, seller, amount):
return f'@{seller} Hi, I would like to buy your {} listed for {self.price} ' \
f'{self.currency} in Delve. I will take all {amount} for a total of {self.price * amount} {self.currency}.' \
f'Please dont add me to party, just write that u agree! Thanks!'
class Search:
items: list
custom_message: str = None
def go(self, more_than=1):
for item in self.items:
data =
for nick, amount in data.most_common():
if amount > more_than:
print(item.get_message(nick, amount))
cheap_fossils = [
Item('Aberrant Fossil', 1, 'chisel', '',
'More Chaos modifiers, No Lightning modifiers'),
sidhebreath_alch = Item('Sidhebreath Paua Amulet ', 1, 'alchemy', '')
sidhebreath_fusing = Item('Sidhebreath Paua Amulet ', 1, 'fusing', '')
bound_fossil = Item('Bound Fossil', 1, 'chaos', '')
if __name__ == '__main__':
while True:
while True:
Item('Bound Fossil', 1, 'chaos', ''),
Item('Jagged Fossil', 2, 'chaos', ''),
Item('Bound Fossil', 1, 'chaos', ''),
Item('Tangled Fossil', 1, 'chaos', ''),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment