Commit 57b4e89d authored by BooDonky's avatar BooDonky
Browse files

Methods until searcher added

parent 8a58bf13
name value domain
SIDCC AJi4QfEHM8qUBsn9bDjHEWQ-KiMxLtRTStabuRG7ehd5I9G97JXMd-7oKEksjZ2HXgHEvFrvnX0 .google.com
__Secure-1PSID DQjbiLhs96THHTumujPa4HWDWEdj17TFPNCkDY2cfXo41Rx7ZN8MF5qJVJ0v-vZ2phXkiw. .google.com
SID DQjbiLhs96THHTumujPa4HWDWEdj17TFPNCkDY2cfXo41Rx7VQwGcDJB6ccj6TzaCYVBJg. .google.com
APISID 6kk6_zJohn2EASCw/ACYhXfNwGjjwj_XXz .google.com
__Secure-3PSIDCC AJi4QfEiPDgwz9F4FZDg0zlzZaOsWZnUlZc_9g2QVzT9pAWS4OmtU6uOxLKSUTRB7NgiEmtltTk .google.com
__Secure-3PAPISID YFGfKuqnDjZRlZcy/ArQKbhka87Jpz1aON .google.com
SAPISID YFGfKuqnDjZRlZcy/ArQKbhka87Jpz1aON .google.com
HSID AK15cgiV5uEaSKzAk .google.com
SSID AETdwfb3STiSj9gT4 .google.com
__Secure-3PSID DQjbiLhs96THHTumujPa4HWDWEdj17TFPNCkDY2cfXo41Rx7N_bG7pq7SW1w3A_Lk3mpqw. .google.com
__Secure-1PAPISID YFGfKuqnDjZRlZcy/ArQKbhka87Jpz1aON .google.com
NID 511=fHZ7pl8sUEjuHSezE1Gtny27AXwb1n-Wqm45dGMnoVoeoHM9AlPgYlfZGK4004yrWsIGmcrpugXsToUUdfPJxFqgFG-KVxukUizZRsQMI5X6QeJuzhPI0v-7z6qL9Jt9o1Bn76gRR95NeMlVGP347BAVcgOjKB7eG80EWwB41EJLfRXvWI76RuTW_fO-FStaFpnzJRqESDfLMbAwoapThsZo_JBrLFv-x46XZVbewFkXtuyx1Vi5YKlOpTFdNaNZWI25XAD3jLlNUaljl4XCz0s-_PkNzw6g94roDfEGmB1Zr1wG8gSYMsnCghXNwgI1SD-xMlZvj3EEIIvAM2i5S-Jch08AbOZmH-aq1kJq1IAmXN145HOMNUyo7QXIJiCAZqombpIjUkjuBuu2BEDZNK5hPKZ57Ue6iAD2wcy1pcFc8p7IOO65Dy7YRHGF_I0PTXR0cQh_RCjqDYP9Ycxwyl9ELiHvlY3yge0wcXPuKhxBDe9p .google.com
1P_JAR 2021-11-16-17 .google.com
OTZ 6224512_52_52_123900_48_436380 www.google.com
CONSENT YES+CH.de+V13+BX .google.com
SEARCH_SAMESITE CgQIrZMB .google.com
ANID AHWqTUmdHg-U9fWwdLaTEes68K8c3H8YmOIq-_Kkp5hmOSeFEUbvohZ4LjMzm-2J .google.com
OGPC 19026101-2:19022622-2: .google.com
_gid GA1.2.506733716.1637162554 .bataclan.fr
PHPSESSID c80fc550ad2bbace3e615739e191b0c0 www.bataclan.fr
SSESS16975927c8bf55966191d0a85b94c1dd AAlG0xIL8XDbjpToZICUl-HRju-6Sps3ycltkdJbSeM .billetterie.bataclan.fr
_icl_current_language en www.bataclan.fr
_gat_gtag_UA_7119279_23 1 .bataclan.fr
bdsp 1 billetterie.bataclan.fr
CookiePlusCookiesAccepted %7B%22groups%22%3A%22all%22%2C%22expiration_time%22%3A1668698585%2C%22date_created%22%3A%222021-11-17%2016%3A23%3A05%22%7D www.bataclan.fr
_ga GA1.2.409191840.1637162554 .bataclan.fr
has_js 1 billetterie.bataclan.fr
S billing-ui-v3=zog79AlvJtjr6H3g5So3EBDSgONSfYlT:billing-ui-v3-efe=zog79AlvJtjr6H3g5So3EBDSgONSfYlT .google.com
name,value,domain
_GRECAPTCHA, 09ABBMTcO_E77DXraILlgoUa7uG5CQG6sItiMzZtLf74ARdnDNJZoD8JU14zD2LBOGW76evQqBZ2FKhc6Yr94Gb1Y, www.google.com
SSESS16975927c8bf55966191d0a85b94c1dd, 3ajD0OuILm8hVzpKPez2MTigMMZtvCzjY_URaU9IFko, .billetterie.bataclan.fr
bdsp, 1, billetterie.bataclan.fr
has_js, 1, billetterie.bataclan.fr
_icl_current_language, en, www.bataclan.fr
_gat_gtag_UA_7119279_23, 1, .bataclan.fr
CookiePlusCookiesAccepted, %7B%22groups%22%3A%22all%22%2C%22expiration_time%22%3A1668712641%2C%22date_created%22%3A%222021-11-17%2020%3A17%3A21%22%7D, www.bataclan.fr
_gid, GA1.2.1927204136.1637176561, .bataclan.fr
_ga, GA1.2.1466865724.1637176561, .bataclan.fr
PHPSESSID, a52fc946499f7869dd470146bff35931, www.bataclan.fr
\ No newline at end of file
from selenium import webdriver
from csv import DictReader
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support import expected_conditions as EC
from tools.web_function_tools import get_cookies_values,cookie_adder
from selenium.webdriver.support.ui import Select
import time
import pickle
def cookies_saver(driver):
driver.find_element_by_xpath("/html/body/aside[1]/a").click()
driver.find_element_by_xpath("//*[@id='block-locale-language']/div/ul/li[1]/a").click()
driver.find_element_by_xpath("//*[@id='edit-name']").send_keys(email)
driver.find_element_by_xpath("//*[@id='edit-pass']").send_keys(pw)
driver.find_element_by_xpath("//*[@id='edit-submit']").click()
# storing the cookies
pickle.dump(driver.get_cookies(), open("cookies.pkl", "wb"))
driver.quit()
def cookies_loader(driver):
# loading the stored cookies
cookies = pickle.load(open("cookies.pkl", "rb"))
for cookie in cookies:
# adding the cookies to the session through webdriver instance
driver.add_cookie(cookie)
driver.refresh()
def login(driver):
driver.find_element_by_xpath("/html/body/aside[1]/a").click()
driver.find_element_by_xpath("//*[@id='block-locale-language']/div/ul/li[1]/a").click()
driver.find_element_by_xpath("//*[@id='edit-name']").send_keys(email)
driver.find_element_by_xpath("//*[@id='edit-pass']").send_keys(pw)
driver.find_element_by_xpath("//*[@id='edit-submit']").click()
def searcher(driver,url_bookingsite):
driver.maximize_window()
# driver.get("https://www.bataclan.fr/en/event/cult-of-ya-fest_2022-01-15/")
driver.get(url_bookingsite)
# driver.execute_script("document.body.style.zoom='50%'")
driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
def booker(driver):
driver.find_element_by_xpath("//span[text()='Book now']").click()
driver.find_element_by_xpath("//*[@id='generic-catalog-meeting-form']/div/div[1]/div[1]/ul/li/ul/li[1]").click()
select = Select(driver.find_element_by_tag_name("select"))
# select by visible text
select.select_by_visible_text('3')
time.sleep(2)
driver.find_element_by_name("op").click()
def card_information(driver,cardnumber,cvv,expire_date, holder_name):
driver.find_element_by_xpath
url = "https://www.bataclan.fr/"
csv = "files/bataclan_cookies.csv"
url_bookingsite = "https://billetterie.bataclan.fr/meeting/3601/david-carreira/bataclan/11-02-2022/20h00"
#url_bookingsite = "https://www.bataclan.fr/en/event/the-jesus-mary-chain_2021-12-05/"
csv = "files/bataclan_cookies.csv"
email = "dominik.nguyen98@gmx.ch"
pw = "GoogleCool11"
driver = webdriver.Chrome()
driver.get(url)
cookies = get_cookies_values(csv)
#cookies_saver(driver)
#cookies_loader(driver)
login(driver)
searcher(driver, url_bookingsite)
booker(driver)
cookie_adder(driver, cookies)
from csv import DictReader
import pickle
def get_cookies_values(file):
with open(file, encoding="utf-8-sig") as f:
......@@ -8,6 +8,7 @@ def get_cookies_values(file):
return list_of_dicts
def cookie_adder(driver,cookies):
for i in cookies:
driver.add_cookie(i)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment