Closed dan-osull closed 4 years ago
Hey,
Thanks very much for the package!
I noticed the other day that CraigslistForSale results weren't being correctly populated with images.
I ran through the code with a debugger.
It looks like everything is OK until this line:
if 'src' not in img: # Some posts contain empty <img> tags.
It seems to always evaluate to True.
True
This is the type of img:
img
<class 'bs4.element.Tag'>
I wonder if something recently changed in Beautiful Soup?
This seems to fix the problem for me:
if 'src' not in str(img):
Or maybe this is better?
if 'src' not in img.attrs.keys():
Versions:
Python 3.8.2 on Linux beautifulsoup4==4.9.1 python-craigslist==1.0.8
Thanks so much @weebsnore for reporting this! Seems to be that the package has been having an issue with images for some time. I've fixed it and already released version 1.0.10 with the fix. Thanks again!
1.0.10
Hey,
Thanks very much for the package!
I noticed the other day that CraigslistForSale results weren't being correctly populated with images.
I ran through the code with a debugger.
It looks like everything is OK until this line:
if 'src' not in img: # Some posts contain empty <img> tags.
It seems to always evaluate to
True
.This is the type of
img
:I wonder if something recently changed in Beautiful Soup?
This seems to fix the problem for me:
Or maybe this is better?
Versions:
Python 3.8.2 on Linux beautifulsoup4==4.9.1 python-craigslist==1.0.8