From 603a989b7d4be9ff045013680fc66956f93c9dbc Mon Sep 17 00:00:00 2001 From: stilManiac Date: Thu, 1 Nov 2018 09:18:03 +0200 Subject: [PATCH] init commit --- main.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 main.py diff --git a/main.py b/main.py new file mode 100644 index 0000000..c1e6357 --- /dev/null +++ b/main.py @@ -0,0 +1,23 @@ +import requests +from bs4 import BeautifulSoup + +url = 'https://www.steamgifts.com' +cookies = {'PHPSESSID': '7dmn87d0a539pridhlqmm317fs2vbqom6irggn1i84pffud5u0dethqndbcpbvtqsofd4kav483rqac89ma3g2qtbnbmgkas3f0jnf3'} +r = requests.get(url, cookies=cookies) + +soup = BeautifulSoup(r.text, 'html.parser') +point = soup.find('span', {'class': 'nav__points'}).text +gifts_list = soup.find_all(lambda tag: tag.name == 'div' and tag.get('class') == ['giveaway__row-inner-wrap']) + +for test in gifts_list: + item = test.find('a', {'class': 'giveaway__heading__name'}) + # get code of each gift and add it to a list + print(item) + + +def entry_gift(): + payload = {'xsrf_token': '4feb9badc54974acef041a7ebdd6b2e6', 'do': 'entry_insert', 'code': 'AaPCO'} + entry = requests.post('https://www.steamgifts.com/ajax.php', data=payload, cookies=cookies) + print(entry.text) + +