win scraping
- will scape won games at start to update db for giveaways the bot has entered - schedules a once a day run of scraping won giveaways
This commit is contained in:
parent
de2379587e
commit
48c030f445
10 changed files with 200 additions and 13 deletions
22
src/bot/won_entry.py
Normal file
22
src/bot/won_entry.py
Normal file
|
@ -0,0 +1,22 @@
|
|||
import re
|
||||
from .log import get_logger
|
||||
import time
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
|
||||
class WonEntry:
|
||||
|
||||
def __init__(self, soup_item):
|
||||
self.game_name = None
|
||||
self.giveaway_game_id = None
|
||||
self.giveaway_uri = None
|
||||
|
||||
logger.debug(f"Won Giveaway html: {soup_item}")
|
||||
self.game_name = soup_item.find('a', {'class': 'table__column__heading'}).text
|
||||
self.giveaway_game_id = soup_item.find('a', {'class': 'table__column__heading'})['href'].split('/')[2]
|
||||
self.giveaway_uri = soup_item.select_one('a.table__column__heading')['href']
|
||||
logger.debug(f"Scraped Won Giveaway: {self}")
|
||||
|
||||
def __str__(self):
|
||||
return str(self.__class__) + ": " + str(self.__dict__)
|
Loading…
Add table
Add a link
Reference in a new issue