Skip to content

Commit

Permalink
Simplify [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
ping committed Jul 30, 2023
1 parent d026e43 commit 4a701f1
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions recipes/new-republic-magazine.recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,7 @@ def _article_endpoint(self, nid):
label
}
}"""
variables = {"nid": str(nid)}
params = {"query": query, "variables": json.dumps(variables)}
params = {"query": query, "variables": json.dumps({"nid": str(nid)})}
return f"https://newrepublic.com/graphql?{urlencode(params)}"

def _resize_image(self, image_url, width, height):
Expand All @@ -180,7 +179,6 @@ def _resize_image(self, image_url, width, height):
:param height:
:return:
"""
max_width = self.scale_news_images[0] if self.scale_news_images else 800
crop_params = {
"auto": "compress",
"ar": f"{width}:{height}",
Expand All @@ -190,7 +188,7 @@ def _resize_image(self, image_url, width, height):
"ixlib": "react-9.0.2",
"dpr": 1,
"q": 65,
"w": max_width,
"w": self.scale_news_images[0] if self.scale_news_images else 800,
}
url_tuple = urlsplit(image_url)
return f"{url_tuple.scheme}://{url_tuple.netloc}{url_tuple.path}?{urlencode(crop_params)}"
Expand Down

0 comments on commit 4a701f1

Please sign in to comment.