Smartgambler
Pro-Punter

Go Back   OZmium Sports Betting and Horse Racing Forums > Public Forums > General Topics
User Name
Password
Register FAQ Search Today's Posts Mark all topics as read

To advertise on these
forums, e-mail us.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 25th February 2024, 06:23 AM
ballybeg ballybeg is offline
Member
 
Join Date: Jun 2012
Posts: 12
Angry Tab api changes

Has anyone had any luck using the tab api after they made changes recently? Don’t know what the changes were, I just can’t pull data down since Thursday
Reply With Quote
  #2  
Old 29th February 2024, 05:03 PM
Shaun Shaun is offline
Member
 
Join Date: Jan 1970
Location: Western Australia
Posts: 3,456
Default

I fixed mine with help from Discord, i can post what i was told, i had to make changes to the way i was retrieving data, i was previously using Requests with python but i had to change to Selenium so i could create a browser, the browser runs in headless mode, this is what i was told about the issue.

Quote:
by default the user agent is:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36

in headless mode, the user agent is:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/121.0.0.0 Safari/537.36

this contains "HeadlessChrome" which may be blocked, so set the user agent back to the default

options.add_argument("--headless=new")
options.add_argument('--user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36"')


I know you can use Selenium with excel but i have not done that as yet, here is my python code that gets around this issue.

Quote:
from selenium import webdriver
from selenium.webdriver.common.by import By

options = webdriver.ChromeOptions()
options.add_argument("--headless=new")
options.add_argument('--user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) '
'Chrome/121.0.0.0 Safari/537.36"')
driver1 = webdriver.Chrome(options=options)

driver1.get("https://api.beta.tab.com.au/v1/tab-info-service/racing/dates/2024-02-26/meetings/R/NOW/races/1/?jurisdiction=VIC")

data = driver1.find_element(By.XPATH, "/html/body").text
print(data)
driver1.close()
__________________
One Drive

"If the corporates are treating you poorly , just go elsewhere."
"If they need you , they will soon find out."
"If you need them , you will soon find out."
--moeee
_______________________________________________
Reply With Quote
  #3  
Old 2nd March 2024, 04:54 AM
ballybeg ballybeg is offline
Member
 
Join Date: Jun 2012
Posts: 12
Default

Thanks, UserAgent was the issue
Reply With Quote
  #4  
Old 2nd March 2024, 09:46 AM
Shaun Shaun is offline
Member
 
Join Date: Jan 1970
Location: Western Australia
Posts: 3,456
Default

Quote:
Originally Posted by ballybeg
Thanks, UserAgent was the issue


Do you use excel to get your info or something else?
__________________
One Drive

"If the corporates are treating you poorly , just go elsewhere."
"If they need you , they will soon find out."
"If you need them , you will soon find out."
--moeee
_______________________________________________
Reply With Quote
  #5  
Old 3rd March 2024, 05:12 PM
ballybeg ballybeg is offline
Member
 
Join Date: Jun 2012
Posts: 12
Default

I use both vba in Ms Access and vb.net
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is On
Forum Jump



All times are GMT +10. The time now is 06:35 PM.


Powered by: vBulletin Version 3.0.3
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
©2008 OZmium Pty. Ltd. All rights reserved . ACN 091184655