LiveScore

FREEMIUM
Verified
โœ“
By Api Dojo | Updated 21 giorni fa | Sports
Popularity

9.9 / 10

Latency

2,185ms

Service Level

100%

Health Check

N/A

Back to All Discussions

Hockey Team Image/Logo

Rapid account: Wakpedwakyeng
wakpedwakyeng
5 months ago

Hi there. Currently i try with your API, btw itโ€™s awesome.

But, i have a problem when showing hockey category that one of your endpoint in:
https://livescore6.p.rapidapi.com/teams/detail?ID=xxxx

Show like this: โ€œImgโ€: โ€œenet/261.pngโ€,

Thatโ€™s not a correct url right? How can i show that? Because i already ready your doc and canโ€™t find the solution. I already see the previous discussion that bring me like this: https://static.livescore.com/i2/fh/{Ccd}.jpg.

I already try like: https://static.livescore.com/i2/fh/enet/261.png
or
https://static.livescore.com/enet/261.png

but itโ€™s still not working.

Thanks.

Rapid account: Alberthamoui
alberthamoui Commented 5 months ago

To wakpedwakyeng.

I was able to make it work, hereยดs my function,

def get_team_image_url(data, team_index):
base_url = 'https://lsm-static-prod.livescore.com/mediumโ€™
relative_url = data[โ€˜LeagueTableโ€™][โ€˜Lโ€™][0][โ€˜Tablesโ€™][0][โ€˜teamโ€™][team_index][โ€˜Imgโ€™]
absolute_url = f"{base_url}/{relative_url}"

img = requests.get(absolute_url)
if img.status_code == 200:
    print("Image downloaded successfully.")
elif img.status_code == 404:
    print("Image not found. Check the URL.")
else:
    print(f"Failed to download image. Status code: {img.status_code}")
return absolute_url

print(get_team_image_url(data, 0))

โ€œ0โ€ in this case is for manchester city

Rapid account: Alberthamoui
alberthamoui Commented 5 months ago

To apidojo,

I read your comment to use 'https://static.livescore.com/i2/fh/{url}.jpgโ€™
but its not working for the team images, only for the country, for example โ€œenglandโ€

Rapid account: Alberthamoui
alberthamoui Commented 5 months ago

I`m having the same problem trying to get the url or path for the soccer teams images

this is what I`m getting: enet/8456.png

Rapid account: Apidojo
apidojo Commented 5 months ago

You should read that discussion again with CARE.

Regards.

Join in the discussion - add comment below:

Login / Signup to post new comments