From c27fbbe44175740bffa959fc21d3d98cb42758ce Mon Sep 17 00:00:00 2001 From: Stijn Peeters Date: Mon, 14 Oct 2024 09:35:27 +0200 Subject: [PATCH] Yet more ways LinkedIn stores image URLs --- datasources/linkedin/search_linkedin.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/datasources/linkedin/search_linkedin.py b/datasources/linkedin/search_linkedin.py index f357341e..a8380b4d 100644 --- a/datasources/linkedin/search_linkedin.py +++ b/datasources/linkedin/search_linkedin.py @@ -79,7 +79,10 @@ def map_item(item): # or alternatively they are stored here: if not images and item["content"] and item["content"].get("articleComponent") and item["content"]["articleComponent"].get("largeImage"): image = item["content"]["articleComponent"]["largeImage"]["attributes"][0]["detailData"]["vectorImage"] - images.append(image["rootUrl"] + image["artifacts"][0]["fileIdentifyingUrlPathSegment"]) + if not image and item["content"]["articleComponent"]["largeImage"]["attributes"][0]["imageUrl"]: + images.append(item["content"]["articleComponent"]["largeImage"]["attributes"][0]["imageUrl"]["url"]) + elif image and image.get("artifacts"): + images.append(image["rootUrl"] + image["artifacts"][0]["fileIdentifyingUrlPathSegment"]) author = SearchLinkedIn.get_author(item)