update steam scraper

This commit is contained in:
doubaniux 2021-02-25 21:52:28 +01:00
parent 1f01871e73
commit 1271ab33c4

View file

@ -193,6 +193,8 @@ class AbstractScraper:
raw_img = img_response.content
content_type = img_response.headers.get('Content-Type')
ext = guess_extension(content_type.partition(';')[0].strip())
else:
ext = None
return raw_img, ext
@ -1132,10 +1134,16 @@ class SteamGameScraper(AbstractScraper):
brief = content.xpath(
"//div[@class='game_description_snippet']/text()")[0].strip()
img_url = content.xpath("//img[@class='game_header_image_full']/@src")[
0].replace("header.jpg", "library_600x900.jpg")
img_url = content.xpath(
"//img[@class='game_header_image_full']/@src"
)[0].replace("header.jpg", "library_600x900.jpg")
raw_img, ext = self.download_image(img_url)
# no 600x900 picture
if raw_img is None:
img_url = content.xpath("//img[@class='game_header_image_full']/@src")[0]
raw_img, ext = self.download_image(img_url)
data = {
'title': title,
'other_title': None,