@@ -47,22 +47,24 @@ def __init__(self, **settings):
4747
4848 self .logger .info ("Finding games that have card drops remaining" )
4949
50- self .getBadges ()
50+ self .games = self . getGames ()
5151
52- def getBadges (self ):
53- badgeSoup = BeautifulSoup (
52+ def getGames (self ):
53+ gameSoup = BeautifulSoup (
5454 self .session .get ("http://steamcommunity.com/profiles/{}/badges" .format (self .id_ )).text ,
5555 "html.parser" )
5656
5757 games = [
5858 Game (
59- re .match (r"([0-9]+|(No)) card drops? remaining" , game .find ("span" , {"progress_info_bold" }).text ).group (1 ) if re .match (r"([0-9]+|(No)) card drops? remaining" , game .find ("span" , {"class" : "progress_info_bold" }).text ).group (1 ) != "No" else 0 ,
59+ int ( re .match (r"([0-9]+|(No)) card drops? remaining" , game .find ("span" , {"class" : "progress_info_bold" }).text ).group (1 ) ) if re .match (r"([0-9]+|(No)) card drops? remaining" , game .find ("span" , {"class" : "progress_info_bold" }).text ).group (1 ) != "No" else 0 ,
6060 int (re .match (r"https:\/\/steamcommunity.com\/id\/.+\/gamecards\/([0-9]{6})\/" , game .find ("a" , {"class" : "badge_row_overlay" })["href" ]).group (1 )),
6161 game .find ("div" , {"class" : "badge_title" }).text .replace ("View details" , "" ).strip ()
62- ) for game in filter (lambda p : re .match (r"https:\/\/steamcommunity.com\/id\/.+\/gamecards\/([0-9]{6})\/" , p .find ("a" , {"class" : "badge_row_overlay" })["href" ]) and p .find ("span" , {"class" : "progress_info_bold" }), badgeSoup .find_all ("div" , {"class" : "badge_row" })[:- 1 ])
62+ ) for game in filter (lambda p : re .match (r"https:\/\/steamcommunity.com\/id\/.+\/gamecards\/([0-9]{6})\/" , p .find ("a" , {"class" : "badge_row_overlay" })["href" ]) and p .find ("span" , {"class" : "progress_info_bold" }), gameSoup .find_all ("div" , {"class" : "badge_row" })[:- 1 ])
6363 ]
6464
65- self .logger .info (Fore .GREEN + "Found {} Games." .format (len (games )) + Fore .RESET )
65+ self .logger .info (Fore .GREEN + "Found {} games and {} trading cards to idle" .format (
66+ len (games ),
67+ sum (game .cardsLeft for game in games )) + Fore .RESET )
6668
6769 return games
6870
0 commit comments