billboard-charts icon indicating copy to clipboard operation
billboard-charts copied to clipboard

image url not working?

Open nebudev14 opened this issue 4 years ago • 5 comments

Every time I try to use

song = chart[0] print(song.image)

It keeps returning None (for all songs). Is there any reason for this?

nebudev14 avatar Jun 05 '20 05:06 nebudev14

Thanks, looks like it's broken.

guoguo12 avatar Jun 06 '20 00:06 guoguo12

same here bro!

harshjadon9 avatar Jun 30 '20 23:06 harshjadon9

I guess "broken" isn't entirely accurate, since the code reads

# TODO: Parse the image
image = None

This would be a great first PR for a beginner!

guoguo12 avatar Jul 11 '20 20:07 guoguo12

I took a look at it and attempted a fix.

Looks like the first 10 images on each page are loaded into: <span class="chart-element__image flex--no-shrink" style="background-image: url('https://charts-static.billboard.com/img/2020/02/jack-harlow-16c-whats-poppin-fly-53x53.jpg');"></span>.

The rest of the equivalent spans come up as: <span class="chart-element__image flex--no-shrink" style=""></span> My guess is that the site is using javascript to add the 'background-image' style as the page loads.

If that's the case, the only fix would be to add something like selenium in specifically for the images.

delaneyestrada avatar Aug 26 '20 05:08 delaneyestrada

Fixed here #80

soubenz avatar Dec 06 '20 13:12 soubenz