-2

I received this string as a response from a private API of a sports betting site: https://sport.synottip.cz:

CoEECv4DCvsDCgwKAjEyEgZGb3RiYWwYvwYi5wMKGAoDeDQ0Eg1NZXppbsOhcm9kbsOtGgIxMhLKAwrHAwoGeHgxMjc4EhhLdmFsaWZpa2FjZSBNUywgQ09OTUVCT0waA3g0NCqdAwjUt4wBEhVWZW5lenVlbGEgLSBBcmdlbnRpbmEiBwiAq6TFpzIqCDUzNjI0NjQ5Mt4CCDsSDkhsYXZuw60gc8Ohemt5GmoKCzJkMjIzNTI4MzQ5EgZaw6FwYXMyTwidi8tqEgZaw6FwYXMYkF8iEwoJNDg4Mzg5ODMyEgExHdejsEAiEwoJNDg4Mzg5ODMzEgEwHSlcf0AiEwoJNDg4Mzg5ODM0EgEyHbgexT9YAmACGm8KCzNkMjIzNTI4MzUwEgdEdm9qdGlwMlMInovLahIHRHZvanRpcBiSXyIUCgk0ODgzODk4MjgSAjEwHR+FC0AiFAoJNDg4Mzg5ODI5EgIxMh1I4Zo/IhQKCTQ4ODM4OTgzMBICMDIdheuRP1gBYAIabQoLNGQyMjM1MjgzNTESElPDoXprYSBiZXogcmVtw616eTJGCJ+Ly2oSElPDoXprYSBiZXogcmVtw616eRiTXyITCgk0ODgzODk4MzESATEdcT16QCITCgk0ODgzODk4MzUSATIdmpmZP1gBYAI6Bnh4MTI3OFADYL8G

This string is supposed to be encoded data about a match and the odds. I would appreciate any help with extracting the data.


I already found this great website, and I think the first step I need to take is to base64 decode the string. This will give me the binary data.

It looks like the second step should be to Protobuf decode the data. After that, I am getting a fairly solid JSON output. However, the issue is that where I expect to find the odds, there are only very large numbers. Based on data from the website, I believe that the numbers in the received JSON should correspond to these decimal odds:

1085318103 equals 5,52
1082088489 equals 3,99
1069883064 equals 1,54
1074496799 equals 2,18
1067114824 equals 1,21
1066527621 equals 1,14
1081752945 equals 3,91
1067030938 equals 1,20

I also found some information abou the API here: https://sport.synottip.cz/WebServices/Api/SportsBettingService.svc/help. I am interested in the GetWebStandardEvents and GetWebStandardEventExt calls.

Can anyone help me with the final steps? I prefer docoding it in Python, but help works. Thank you.

5
  • Please provide the request bodies that you sent for each endpoint Commented Sep 17, 2024 at 15:17
  • 1
    Add the code that gives the data you don't like. Commented Sep 17, 2024 at 15:27
  • The web site shows vanilla XML and JSON responses. You shouldn't have to do any decoding, depending on how you got this data. Commented Sep 17, 2024 at 15:40
  • Looking at the API help page, it makes no mention of protocol buffers. The request and response bodies may be XML or JSON. I suspect that you may be querying the API incorrectly. Commented Sep 17, 2024 at 15:41
  • You do not need the bodies, but they looks like this: sport.synottip.cz/WebServices/Api/SportsBettingService.svc/… // I do not have a code yet, since the api itself gives me data I do not like. // Yes, it does show vanilla JSON responses, but in those responses that I need are only encoded data in the format I provided. // I am not querying the API, my browser does. You can see the responses in the developer tools of you browser. // Thank you all for trying to help. Commented Sep 17, 2024 at 18:31

2 Answers 2

3

You are decoding a binary float32 as an int32. You will need to pack the number back into a int32 (long) and then unpack as a float32 (float). You can use the struct module for that.

>>> import struct
>>> struct.unpack("f",struct.pack("l", 1085318103))
(5.519999980926514,)
>>> struct.unpack("f",struct.pack("l", 1067030938))
(1.2000000476837158,)

However, the final solution would be to decode the binary number as a float32 in the Protobuf decoding step.

For additional polish:

>>> round(struct.unpack("f",struct.pack("l", 1066527621))[0],2)
1.14

will pack the long as a binary, unpack the binary as a float, extract the first item of the tuple and round to two digits.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you very much, at least this is solution that I can already use in my process. I will try to look into the Protobuf decoding process though. I am totally new to that so hopefully I will be able to find something. I will appeciate any other suggestions regarding this step. But as I said, thank you very much already for your help.
1

Caveat: This is only a partial answer and not complete but too much for a comment

The numbers are a 32 bit integer representation of 32 bit IEEE 754 single precision floating point numbers and can be converted to the appropriate values using the aforementioned CyberChef. Exactly how you would do this in Python is beyond me as it's not a programming language I'm familiar with.

The recipe can be found here Link to working recipe in CyberChef

Screenshot working recipe in CyberChef

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.