diff --git a/lib/WPImport.py b/lib/WPImport.py index 8c2aa2d..3b4131b 100644 --- a/lib/WPImport.py +++ b/lib/WPImport.py @@ -461,6 +461,19 @@ class WPimport: self._logger.error("{0} : Exception error for post media featured : {1}".format(self._name, err)) else: self._logger.info("{0} : No media found for {1}".format(self._name, h2)) + try: + page = self._request.get(img_src.replace("_q", "")) + if page.status_code == 200: + self._logger.info("{0} : Get image for media featured : {1}".format(self._name, r.json()["title"]["raw"])) + self._addOrUpdateMedia(img_src.replace("_q", ""), page.content) + else: + self._logger.error("{0} : Connection error with status code for get image for featured media : {1}".format(self._name, page.status_code)) + self._logger.debug("{0} : {1}".format(self._name, r.content)) + except ConnectionError as err: + self._logger.error("{0} : Connection error for get to image for featured media : {1}".format(self._name, err)) + exit(1) + except Exception as err: + self._logger.error("{0} : Exception error for get to image media featured : {1}".format(self._name, err)) else: self._logger.error("{0} : Connection error with status code for search featured media: {1}".format(self._name, page.status_code)) self._logger.debug("{0} : {1}".format(self._name, page.content))