Skip to content

Commit

Permalink
fix minor bug in thumbnail url
Browse files Browse the repository at this point in the history
  • Loading branch information
rm03 committed Dec 9, 2023
1 parent fbf3ff7 commit 6e42583
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion dbutils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ def refresh_recent_articles(cron=False):
"createdat": 1,
},
)
site_url = os.environ.get("SITE_URL")
if "34st" in site_url:
tag = "-34s"
elif "underthebutton" in site_url:
tag = "-utb"
else:
tag = ""

for doc in cursor:
embedding = [
float(val)
Expand All @@ -71,7 +79,7 @@ def refresh_recent_articles(cron=False):
"timestamp": datetime.strptime(
doc["createdat"], "%Y-%m-%d %H:%M:%S"
).timestamp(),
"thumbnail_url": f'https://snworksceo.imgix.net/dpn/{doc["dominantmedia"]["attachment_uuid"]}.sized-1000x1000.{doc["dominantmedia"]["extension"]}?w=800'
"thumbnail_url": f'https://snworksceo.imgix.net/dpn{tag}/{doc["dominantmedia"]["attachment_uuid"]}.sized-1000x1000.{doc["dominantmedia"]["extension"]}?w=800'
if "dominantmedia" in doc and isinstance(doc["dominantmedia"], dict)
else "",
},
Expand Down

0 comments on commit 6e42583

Please sign in to comment.