CRutkowski/Kijiji-Scraper

Stopped putting images into the email

Closed this issue · 1 comments

I think Kijiji did something different with the images, so the picture doesn't make it into the email anymore.

'Image': '<img alt="Looking for a Saab 99, 4 or 5 door" data-src="https://i.ebayimg.com/00/s/NTY2WDgwMA==/z/k14AAOSwoCdd0qwc/$_35.JPG" src="https://ca.classistatic.com/static/V/8715/img/placeholder-large.png"/>'

"data-src" still points to the actual image, but "src" only to the placeholder image. What goes to the email is the content of "src". So - no pic of the item in the email...

I can't code. But I'll try.

I'll keep googling and hopefully figure it out. But if anyone has a fix - great!

Ok. I got it working. I don't think it's right - but I get images in the emails now... which is fixed for me. I figured first I need to find the URL in the "data-src" thingy, and then I need to modify the "Image" contents of the database.

I modified "kijiji_ad.py"

Added the following into "locate_info" block:

self.info["DataSource"] = str(self.ad.find('img').get('data-src'))

Then I modified the "# Parse remaining ad information" block:

elif key == "Image":
                    self.info[key] = '<img src =\"' + (self.info["DataSource"]) + '\"/>'

elif key not in ["DataSource", "Details", "Date"]:

I don't think the double quotes work right - but the image still shows up. Hope this helps someone.

Hopefully someone will post the right way to do it.