diff --git a/known_properties.json b/known_properties.json index 49a560f..35866be 100644 --- a/known_properties.json +++ b/known_properties.json @@ -1 +1 @@ -[51968, "803DF7B0-1125-2AA4-90AC-CF0CAEAC625A", "B57516F9-E364-7E54-A211-527ED54388E6", "665243A8-FD34-86F8-322F-FE9B0B392083", "id-88-5-45", "C02892BE-F34F-5A8A-E174-4A79549DC9A9", "3B73B720-13F2-62A4-8829-557676725A95", "B4095706-A65C-F421-B02E-1D227B684B62", "id-193-1-13", -4432880139075606878, 51624, 51628, "F7992488-7C24-DFA9-F8B2-94DDC18E66A3", 3286076625991780524, 51632, "FA45C0B6-813C-DE65-496A-EDD8DA3F2526", "7421A7DD-D9B4-72D3-0A91-5C3DA60C26E4", "9A0B42A2-6D9B-331A-DAA7-624A5FA49606", "A979EBAE-EF87-FB51-152A-5453CD7DC794", "57446DF5-CB9F-951C-A40A-4BA775DA7426", "id-202-1-11", "E7B71D28-C557-CFE4-805D-42C2793E9248", 51656, "id-32-1-41", 51660, 51665, "21C20126-380D-9B0F-73F8-C4279897F189", "id-154-2-71", "281A7F0B-FA5A-75AE-68DE-89AFD90EEF48", "892BD779-F186-9BD1-A97A-5783EFB6F56D", "172DFAD2-7CDB-51B4-212E-E6F9C7F0601A", "id-105-12-78", -9017525000097635974, 51963, "BAAEC20A-F667-FE22-6693-E4B4CA366889", "BD41AC52-BADB-428F-AF4B-11BBC374F2F1"] \ No newline at end of file +[51968, "9A0B42A2-6D9B-331A-DAA7-624A5FA49606", "id-202-1-11", "7421A7DD-D9B4-72D3-0A91-5C3DA60C26E4", "id-147-1-1", "E7B71D28-C557-CFE4-805D-42C2793E9248", "id-145-1-9", "21C20126-380D-9B0F-73F8-C4279897F189", "id-154-2-71", -4432880139075606878, "BAAEC20A-F667-FE22-6693-E4B4CA366889", 51624, "803DF7B0-1125-2AA4-90AC-CF0CAEAC625A", 51628, 3286076625991780524, "665243A8-FD34-86F8-322F-FE9B0B392083", 52087, 51632, "id-105-12-78", "3B73B720-13F2-62A4-8829-557676725A95", "F7992488-7C24-DFA9-F8B2-94DDC18E66A3", "id-88-5-45", 51656, 51660, "892BD779-F186-9BD1-A97A-5783EFB6F56D", "id-32-1-41", 51665, "FA45C0B6-813C-DE65-496A-EDD8DA3F2526", "B57516F9-E364-7E54-A211-527ED54388E6", -9017525000097635974, "A979EBAE-EF87-FB51-152A-5453CD7DC794", "172DFAD2-7CDB-51B4-212E-E6F9C7F0601A", "57446DF5-CB9F-951C-A40A-4BA775DA7426", "id-193-1-13", "B4095706-A65C-F421-B02E-1D227B684B62", "C02892BE-F34F-5A8A-E174-4A79549DC9A9", "BD41AC52-BADB-428F-AF4B-11BBC374F2F1", "281A7F0B-FA5A-75AE-68DE-89AFD90EEF48", 51963] \ No newline at end of file diff --git a/src/lipsia/__pycache__/lipsia.cpython-310.pyc b/src/lipsia/__pycache__/lipsia.cpython-310.pyc index f822c06..bed686f 100644 Binary files a/src/lipsia/__pycache__/lipsia.cpython-310.pyc and b/src/lipsia/__pycache__/lipsia.cpython-310.pyc differ diff --git a/src/lwb/__pycache__/scraper.cpython-310.pyc b/src/lwb/__pycache__/scraper.cpython-310.pyc index 5341b23..19defa9 100644 Binary files a/src/lwb/__pycache__/scraper.cpython-310.pyc and b/src/lwb/__pycache__/scraper.cpython-310.pyc differ diff --git a/src/lwb/lwb_form.xml b/src/lwb/lwb_form.xml new file mode 100644 index 0000000..b638942 --- /dev/null +++ b/src/lwb/lwb_form.xml @@ -0,0 +1,217 @@ + + +
+ + 842F0073-DC21-A841-4E80-B1BD5E404E35 + 4B76A3C8-3E4D-4217-B54A-7C28C920748C + + + <keywords/> + </head> + <client > + <editor name="webapp-professional" version="6.169.22"/> + <device identifier="webapp-professional_6.169.22 win_10 desktop_ff_135" name="desktop ff 135" osName="win" osVersion="10"/> + </client> + <history > + <save oldId="842F0073-DC21-A841-4E80-B1BD5E404E35" newId="4B76A3C8-3E4D-4217-B54A-7C28C920748C" userName="DEMO" timestamp="2025-02-04T22:55:03Z"/> + </history> + <actions> + <action id="01search_re_obj" includeInMenu="false" includeInQuick="false" style="cancel" title="Suchen"> + <type> + <server command="search_re_obj" locksForm="true" waitForResponse="true"/> + </type> + <preconditions valid="true"/> + </action> + <action id="02load_search" includeInMenu="false" includeInQuick="false" title="Suchvariante laden"> + <type> + <server command="load_search" locksForm="true" waitForResponse="true"/> + </type> + </action> + <action id="03delete_search" includeInMenu="false" includeInQuick="false" title="Suche löschen"> + <type> + <server command="delete_search" locksForm="true" waitForResponse="true"/> + </type> + <confirmation> + <title>Suche löschen + Möchten Sie die Gespeicherte Suche endgültig löschen? + Ja + Nein + + + + +
+ true + +
+
+ X + + + + + + + 50 +
+
+ + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 900.00 +
+
+ + + +
+
+ + + +
+
+ \ No newline at end of file diff --git a/src/lwb/scraper.py b/src/lwb/scraper.py index ef41602..d6c47fc 100644 --- a/src/lwb/scraper.py +++ b/src/lwb/scraper.py @@ -1,13 +1,19 @@ import requests import xml.etree.ElementTree as ET import src.lwb.format as format +import gzip + +SESSION_CREATE_URL = "https://portal1s.easysquare.com/meinelwb/index.html?deeplink=%2FESQ_IA_REOBJ%2FESQ_VM_REOBJ_ALL" + +SAP_SESSIONID = "" +COOKIE_SESSION = "" EASYSQUARE_URL = "https://portal1s.easysquare.com/prorex/xmlforms" EASYSQUARE_HEADERS = { "DNT": "1", "Host": "portal1s.easysquare.com", "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", - "Cookie": "SAP_SESSIONID_PP0_581=zVLUPPaDGFVgBQTlA65yRXm5VdjdXBHvhiYKELG5Agg%3d; sap-usercontext=sap-language=D&sap-client=581; cookiesession1=678ADA67ADF0813997206FE9F4133118", + "Cookie": f"SAP_SESSIONID_PP0_581={SAP_SESSIONID}; sap-usercontext=sap-language=D&sap-client=581; cookiesession1={COOKIE_SESSION}", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:134.0) Gecko/20100101 Firefox/134.0", "Accept-Encoding": "gzip, deflate, br, zstd", "Accept-Language": "de,en-US;q=0.7,en;q=0.3", @@ -23,6 +29,8 @@ EASYSQUARE_PARAMS = { "_": "1736761256321" } +SETUP_QUERY_PARAMS_URL = "https://portal1s.easysquare.com/prorex/xmlforms?application=ESQ_IA_REOBJ&sap-client=581&command=action&name=save&id=4B76A3C8-3E4D-4217-B54A-7C28C920748C&api=6.169&head-oppc-version=6.169.22&originalId=842F0073-DC21-A841-4E80-B1BD5E404E35&resourceOrigin=form" + # curl --location 'https://portal1s.easysquare.com/prorex/xmlforms?application=ESQ_IA_REOBJ&sap-client=581&command=action&name=boxlist&api=6.169&head-oppc-version=6.169.22&_=1736761255682' \ # --header 'DNT: 1' \ # --header 'UTC: 1736761256321' \ @@ -44,6 +52,89 @@ EASYSQUARE_PARAMS = { # --header 'X-Requested-With: XMLHttpRequest' +# setup query params for lwb session +def setup_query_params(): + + # request this url with POST an xml form + + # load xml form from file + xml_form = "" + with open("src/lwb/lwb_form.xml", "r") as file: + xml_form = file.read() + + # post xml form to SETUP_QUERY_PARAMS_URL + response = requests.post(SETUP_QUERY_PARAMS_URL, data=xml_form, headers=EASYSQUARE_HEADERS) + + if response.status_code != 200: + print(f"Fehler beim Abrufen von Easysquare: {response.status_code}") + return [] + + print(response.content) + + return response.content + +# Call Session Create and get the session from teh response cookies +def create_session(): + # request url with chromium browser and get the cookies + session = requests.Session() + response = session.get(SESSION_CREATE_URL, allow_redirects=True) + + if response.status_code != 200: + print(f"Fehler Session von Easysquare: {response.status_code}") + return [] + + # get the cookies from the response + cookies = response.cookies + COOKIE_SESSION = cookies.get("cookiesession1") + print(COOKIE_SESSION) + + + url = "https://portal1s.easysquare.com/meinelwb/api5/authenticate?api=6.169&sap-language=de" + + payload = { + 'sap-field_b64': "dXNlcj1ERU1PJnBhc3N3b3JkPXByb21vczE2" + } + headers = { + 'DNT': '1', + 'UTC': '1738713279005', + 'Host': 'portal1s.easysquare.com', + 'host': 'portal1s.easysquare.com', + 'Accept': 'text/html, */*; q=0.01', + 'Cookie': f'esq-alias=%2fmeinelwb; sap-usercontext=sap-language=de&sap-client=581; cookiesession1={COOKIE_SESSION}', + 'Origin': 'https://portal1s.easysquare.com', + 'Referer': 'https://portal1s.easysquare.com/meinelwb/index.html?deeplink=%2FESQ_IA_REOBJ%2FESQ_VM_REOBJ_ALL', + 'Sec-GPC': '1', + 'Connection': 'keep-alive', + 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:135.0) Gecko/20100101 Firefox/135.0', + 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', + 'X-CSRF-Token': 'fetch', + 'Sec-Fetch-Dest': 'empty', + 'Sec-Fetch-Mode': 'cors', + 'Sec-Fetch-Site': 'same-origin', + 'Accept-Encoding': 'gzip, deflate, br, zstd', + 'Accept-Language': 'de,en-US;q=0.7,en;q=0.3', + 'X-Requested-With': 'XMLHttpRequest' + } + + print(headers) + + response = requests.request("POST", url, headers=headers, data=payload) + + print(response.text) + + if response.status_code != 200: + print(f"Fehler beim Session Erstellen via Easysquare: {response.status_code}") + return [] + + # get the cookies from the response + cookies = response.cookies + global SAP_SESSIONID + SAP_SESSIONID = cookies.get("SAP_SESSIONID_PP0_581") + + print(SAP_SESSIONID) + + + # Funktion: Scrape von Easysquare def scrape_easysquare(): session = requests.Session() @@ -51,6 +142,8 @@ def scrape_easysquare(): if response.status_code != 200: print(f"Fehler beim Abrufen von Easysquare: {response.status_code}") + # print("Versuche Session zu erstellen") + # create_session() return [] # XML-Daten parsen