billboard-charts
billboard-charts copied to clipboard
image url not working?
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?
Thanks, looks like it's broken.
same here bro!
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!
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.
Fixed here #80