-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bet365 X-Net-Sync-Term header #26
Comments
Glad you enjoy this repo. |
That explains why I am getting a 'soccerapi.api.base.NoOddsError' |
At the moment no solution about X-Net-Sync-Term header involving on http requests have been found. However this kind of token last for 15 minutes, so a "manual" solution exists.
This solution is temporary and rather cumbersome. |
Hello. The header is complete by some parts of the previous request of the archive "https://www.bet365.es/#/HO/". X-Net-Sync-Term: scEQYA==.Cqo4ETl/ZTDdI4nQ+3LzY9Q5S1o71S3oJrSbQT62jtY= X-Net-Sync-Term: rsUQYA==.Cg7YgMDiCRrO2i+nB/r/ldyYIQMYaxGnEexbtkV5r+0= X-Net-Sync-Term: WscQYA==.bXw1aWdrt+KfTXc1DOdy/nw6W2vdPCk3DD5nf5zvhd4=
X-Net-Sync-Term: TNUQYA==.myYQcI9/rbYHlI666HxVhT1x/TfdpyI2PnUHAlpVfkg= only 3 characters left at the begin and four characters in the midle of the hearder. |
Hello everyone! Seems like the key is changes with a message in one of the two web sockets, about every 15 minutes - you can easily trace which one (the slower one). |
soccerapi 0.7.1 fix this issue. Now when you perform the first request to bet365 a browser instance created which grab the I decide against the reversing the algo that generate |
I have been working with copy bots for a long time, mainly with bet365, I know that bet365 encrypts silver for this base64 token request. this request has existed since last year, but only in POST requests. |
@victorratts13 Have you found a solution to get it? It seems that Puppeteer is not working anymore. I think they have been blocking the access to get the data needed. Do you know how to solve it? |
How do you get to this point? You run this after page load? Can you share the code? |
If you can find any way to solve the first part, please, let me know) |
I'm not able to work atm, but here's the code which reverts the first part of the token to int (which is a timestamp). Later on in the code the timestamp is compared to the server time + offset. That's how I know it is precisely a timestamp. The code for the ConvertBase64ToNumber function they use to decode the first part of the token: var t;
!function (e) {
function t(e) {
return e - 0
}
function n(t, n) {
var i = Math.pow(10, n);
return ((t + e.Epsilon) * i + .5 << 0) / i
}
function i(t) {
return (100 * (t + e.Epsilon) + .5 << 0) / 100
}
function r(t) {
return (100 * (t + e.Epsilon) << 0) / 100
}
function o(e) {
return ~~e
}
function s(e) {
return e - e % 1
}
function a(e) {
var t,
n,
i,
r,
o = atob(e),
s = o.length,
a = new Uint8Array(new ArrayBuffer(s));
for (t = 0; s > t; t++)
a[t] = o.charCodeAt(t);
for (n = new ArrayBuffer(a.length), i = new DataView(n), t = 0, r = a.length; r > t; t++)
i.setUint8(a.length - 1 - t, a[t]);
return i.getUint32(0)
}
e.Epsilon = Math.pow(2, -52),
e.StringToNumber = t,
e.ToNDecimalPlaces = n,
e.To2DecimalPlaces = i,
e.RoundDownTo2DecimalPlaces = r,
e.StringToInteger = o,
e.Truncate = s,
e.ConvertBase64ToNumber = a
} Then just split the token and call ConvertBase64ToNumber with it ... I still don't know what the use to generate it in the first place though. ... And the function to encode it to Base64, for that matter... |
Conver back
So maybe it's a decision |
@vcherniatyn can you get the token without using webdrivers? |
The question now is how to get the header of this request by using puppeteer or other method. If you check on network and XHR methods, the X-NET-SYNC-TERM is already there. I use to intercept this information using puppeteer but the Bet365 started to block it. You can get any information using Chrome, Firefox or Edge, but the question now is how to automate it again. Any suggestions in order to get the Puppeteer working again or using another method? |
I used puppeteer/selenium+chrome(headless or not) + individual socks5 proxy and currently seems like it was automated.. |
Can you share the code with us? |
I use puppeteer with this args page.EvaluateExpressionOnNewDocumentAsync("Object.defineProperty(navigator, 'webdriver', { get: () => undefined })").Wait(); code example:
|
My algo- |
Oh ok, this is the common solution most people use, intercept request and extract the |
I have extracted this simple code from your soccerapi but it doesnt work properli. async def Resultado(): xnet = Resultado() Function Resultado returns: <coroutine object Resultado at 0x00000217A71759C0>. |
So now first part of token is not a problem..
|
@vcherniatyn why are you using websockets? If you can successfully get a token from the homepage (say by watching the headers on the api call) it lasts for 15 minutes. The websockets are just used for inplay data and will refresh the token when needed. |
Now behaviour is different... |
I found out this myself.. after wondering why the bot was not working for the last couple of days... Is it reliable to fetch the token each 15min from the mainpage? |
Yes, it's reliable but the cuestion is if you are able to automate get this header. I can´t automate this. When I get manually the header y can get odds by request, in python and visual basic. |
Preliminary way(not tested completely) Need to get 'q' variable from the script
If you make these steps you can get the token Why preliminary way? I hope this helps everyone! PS |
Good night. I also cannot access the bet365 website after using the puppeteer. Is this temporary or permanent? How do I get the requests that the bet365 page makes and its headers? I thank you for your help. =) |
You missed the final btoa conversion |
Can you generate the second part? I have seen then code changes usually. |
Hey guys, the solution with puppeteer worked for me using proxy. If you are willing to pay a little bit to it works I suggest luminati proxy, is very easy to use it with puppeteer, I changed the
Although I'm still looking for a better way to do it without browser or proxy this is a very good temporary solution |
Which subscription model do you use with luminati? How much does it cost/month? |
Hi guys, I just try to decrypt the
on
on I just upload the code I am using: https://github.com/marc6691/bet365-websocket/blob/master/bet365.py |
How long is the token valid for? How many request? |
Does BET365 run this project themselves? If so, can you please share the link? |
Hi, I think everibody here is in a bet365 project. |
bet365 now blocking puppeteer. Who trying bypass this? |
@caffreysbb use this docker to generate the Bet365 X-Net-Sync-Term header
|
Hello guys, a bit late, but I found this interesting discussion, where @incapdns exposes a solution that could let us get rid of the browser emulation thing. The only downside is that it's written in js (and it can't be otherwise since it executes the js code provided by bet365). On the other side we could get much less overhead.
|
Reverse the generation process of X-Net-Sync-Term it's quite tricky but doable in javascript. For an easy solution for getting a valid X-Net-Sync-Term try https://github.com/S1M0N38/soccerapi-server . It's a docker container that you have to run in back ground to which you can ask X-Net-Sync-Term by a simple http request. New X-Net-Sync-Terms are generated every 10 minutes. |
Hello, does anyone here have a working method to extract that token in 2022? I think they've changed it so that same tokens cant be used for different requests. |
2023 same question |
2023 igualmente |
Hello @S1M0N38, some weeks ago I tested the soccerapi for Bet365 and it worked fine. Today I tried again but the requests made to get the odds had no response resulting in
NoOddsError
. I looked in my browser how Bet365 does that request and I noticed that in the browser they had a different header calledX-Net-Sync-Term
, when I added this header hard coded with the same value as my browser(ImoQYA == .8CwDX5TgJEH5wFCEu1sxh4h1RjAoyXeM6gjjlcGuetw =
) the api worked again.Do you know how this header work? I didn't found much about it. I don't know either how long this hard coded header will work.
Thanks a lot for your help, your repository is awesome!
The text was updated successfully, but these errors were encountered: