[instagram] remove 'candidates' number check (#7921)
Too many false positives (e.g. #7989 #8071) and only checking image dimensions should catch these "errors" as well.
This commit is contained in:
@@ -223,8 +223,7 @@ class InstagramExtractor(Extractor):
|
|||||||
for num, item in enumerate(items, 1):
|
for num, item in enumerate(items, 1):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
candidates = item["image_versions2"]["candidates"]
|
image = item["image_versions2"]["candidates"][0]
|
||||||
image = candidates[0]
|
|
||||||
except Exception:
|
except Exception:
|
||||||
self.log.warning("Missing media in post %s",
|
self.log.warning("Missing media in post %s",
|
||||||
data["post_shortcode"])
|
data["post_shortcode"])
|
||||||
@@ -240,12 +239,7 @@ class InstagramExtractor(Extractor):
|
|||||||
video = None
|
video = None
|
||||||
media = image
|
media = image
|
||||||
|
|
||||||
if len(candidates) <= 3 and not post.get("__gdl_gen"):
|
if image["width"] < item.get("original_width", 0) or \
|
||||||
self.log.warning(
|
|
||||||
"%s: Image candidate list possibly incomplete "
|
|
||||||
"(%s items). Consider refreshing your cookies.",
|
|
||||||
data["post_shortcode"], len(candidates))
|
|
||||||
elif image["width"] < item.get("original_width", 0) or \
|
|
||||||
image["height"] < item.get("original_height", 0):
|
image["height"] < item.get("original_height", 0):
|
||||||
self.log.warning(
|
self.log.warning(
|
||||||
"%s: Available image resolutions lower than the "
|
"%s: Available image resolutions lower than the "
|
||||||
@@ -711,7 +705,6 @@ class InstagramAvatarExtractor(InstagramExtractor):
|
|||||||
"caption" : None,
|
"caption" : None,
|
||||||
"like_count": 0,
|
"like_count": 0,
|
||||||
"image_versions2": {"candidates": (avatar,)},
|
"image_versions2": {"candidates": (avatar,)},
|
||||||
"__gdl_gen" : True,
|
|
||||||
},)
|
},)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user