Dostal som ulohu a poprosil by som Vas o pomoc ako na to, vopred velmi pekne dakujem. Tu je ta uloha:
Webscrapingstránkyhttps://pin-up.bet/, športTenis (odporúčampoužiťknižnicu requests a json).
Načítanie ID zápasov
import requests
import json
burp0_url = "https://sport.pin-up.bet:443/InPlay/GetEventsList"
burp0_cookies = {"__cfduid": "dff203d9ffe7cb9f07101c0fbf0ca23511562058910", "iOSFix": "sport.pin-up.bet", "_ga": "GA1.2.1012685747.1562058910", "_gid": "GA1.2.1444933814.1562058910", "_gat": "1", "ASP.NET_SesssionId": "jkcaaod55pqmocuxodrcefxi", "__cfruid": "4f5c6f69863ee1f7c6af549797383c6e11ba1cf3-1562066642", "_gat_gtag_UA_106090315_1": "1", "_gat_gtag_UA_133587723_1": "1"}
burp0_headers = {"User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0", "Accept": "application/json, text/javascript, */*; q=0.01", "Accept-Language": "en-US,en;q=0.5", "Accept-Encoding": "gzip, deflate", "Referer": "https://sport.pin-up.bet/SportsBook/EventView/5125087?game=Facundo-Bagnis-Laurynas-Grigelis", "Content-Type": "application/json; charset=utf-8", "X-Requested-With": "XMLHttpRequest", "Connection": "close"}
burp0_json={"langId": 2, "partnerId": 65, "sportId": 3, "stTypes": [1, 702, 2, 3, 37]}
web_data = requests.post(burp0_url, headers=burp0_headers, cookies=burp0_cookies, json=burp0_json).json()
print(web_data)
Načítanie každého zápasu.
array_of_players = ???
forplayer_id in array_of_players:
#get allpages
import requests
import json
burp0_url = "https://sport.pin-up.bet:443/InPlay/GetEventStakes"
burp0_cookies = {"__cfduid": "dff203d9ffe7cb9f07101c0fbf0ca23511562058910", "iOSFix": "sport.pin-up.bet", "_ga": "GA1.2.1012685747.1562058910", "_gid": "GA1.2.1444933814.1562058910", "_gat": "1", "ASP.NET_SesssionId": "jkcaaod55pqmocuxodrcefxi", "__cfruid": "4f5c6f69863ee1f7c6af549797383c6e11ba1cf3-1562066642", "_gat_gtag_UA_106090315_1": "1", "_gat_gtag_UA_133587723_1": "1"}
burp0_headers = {"User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0", "Accept": "application/json, text/javascript, */*; q=0.01", "Accept-Language": "en-US,en;q=0.5", "Accept-Encoding": "gzip, deflate", "Referer": "https://sport.pin-up.bet/SportsBook/EventView/5125087?game=Facundo-Bagnis-Laurynas-Grigelis", "Content-Type": "application/json; charset=utf-8", "X-Requested-With": "XMLHttpRequest", "Connection": "close"}
burp0_json={"eventNumber": EVENT_ID, "langId": 2, "partnerId": 65}
event_id = requests.post(burp0_url, headers=burp0_headers, cookies=burp0_cookies, json=burp0_json).json()
print(event_id)
Zo stránokzápasovuložnasledujúce data – menáhráčov, kurzynavíťazazápasu, kurzynavýťazaaktuálnehosetu a všetkýchnasledujúcich, kurzynavýťazaaktuálnehogemu a všetkýchnasledujúcich.
Vzorovývýstup - [{'Name': 'Jan-Lennard Struff - Matteo Berrettini', 'Events': {'MatchWinner': {'1': 1.93, '2': 1.77}, '1. SetWinner': {'1': 1.95, '2': 1.75}, '1. GameWinner': {'1': 1.07, '2': 6.8}, '2. GameWinner': {'1': 7.2, '2': 1.06}}, 'web_scrape': 'Betrally'}, {'Name': 'Alison Riske - Veronika Kudermetova', 'Events': {'MatchWinner': {'1': 1.41, '2': 2.69}, '6. GameWinner': {'1': 4.7, '2': 1.15}, '7. GameWinner': {'1': 1.23, '2': 3.7}}, 'web_scrape': 'Betrally'}, {'Name': 'Tatjana Maria - Donna Vekic', 'Events': {'MatchWinner': {'1': 3.55, '2': 1.25}, '1. SetWinner': {'1': 2.88, '2': 1.36}, '1. GameWinner': {'1': 2.88, '2': 1.36}, '2. GameWinner': {'1': 1.63, '2': 2.14}}, 'web_scrape': 'Betrally'}, {'Name': 'Alexander Bublik - Jack Draper', 'Events': {'MatchWinner': {'1': 1.1, '2': 5.8}, '3. GameWinner': {'1': 1.03, '2': 9.0}, '4. GameWinner': {'1': 3.7, '2': 1.23}}, 'web_scrape': 'Betrally'}, {'Name': 'Joao Sousa - Jannik Sinner', 'Events': {'MatchWinner': {'1': 1.61, '2': 2.17}, '4. GameWinner': {'1': 8.4, '2': 1.04}, '5. GameWinner': {'1': 1.2, '2': 4.0}}, 'web_scrape': 'Betrally'}]