Skip to content

Commit cf0b08e

Browse files
Merge pull request #32 from kryuchenko/fix/telesco-pe-media-urls
Fix telesco.pe media URLs not working since August 7-8, 2025
2 parents b0a4a59 + 7df2ca1 commit cf0b08e

1 file changed

Lines changed: 23 additions & 1 deletion

File tree

nyan/client.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,12 @@ def _send_photo(
236236
parse_mode: str = "html",
237237
) -> Response:
238238
url_template = self.host + "/bot{}/sendPhoto"
239+
240+
# TODO: TEMPORARY FIX - Replace telesco.pe with old CDN domain
241+
# See issue #31 for proper long-term solutions
242+
if "telesco.pe" in photo:
243+
photo = photo.replace("telesco.pe", "cdn-telegram.org")
244+
239245
params = {
240246
"chat_id": issue.channel_id,
241247
"caption": text,
@@ -278,6 +284,12 @@ def _send_video(
278284
parse_mode: str = "html",
279285
) -> Response:
280286
url_template = self.host + "/bot{}/sendVideo"
287+
288+
# TODO: TEMPORARY FIX - Replace telesco.pe with old CDN domain
289+
# See issue #31 for proper long-term solutions
290+
if "telesco.pe" in video:
291+
video = video.replace("telesco.pe", "cdn-telegram.org")
292+
281293
params = {
282294
"chat_id": issue.channel_id,
283295
"caption": text,
@@ -299,14 +311,24 @@ def _send_photos(
299311
parse_mode: str = "html",
300312
) -> Response:
301313
url_template = self.host + "/bot{}/sendMediaGroup"
314+
315+
# TODO: TEMPORARY FIX - Replace telesco.pe with old CDN domain
316+
# See issue #31 for proper long-term solutions
317+
fixed_photos = []
318+
for photo in photos:
319+
if "telesco.pe" in photo:
320+
fixed_photos.append(photo.replace("telesco.pe", "cdn-telegram.org"))
321+
else:
322+
fixed_photos.append(photo)
323+
302324
media = [
303325
{
304326
"type": "photo",
305327
"media": photo,
306328
"caption": text if i == 0 else "",
307329
"parse_mode": parse_mode,
308330
}
309-
for i, photo in enumerate(photos)
331+
for i, photo in enumerate(fixed_photos)
310332
]
311333
params = {
312334
"chat_id": issue.channel_id,

0 commit comments

Comments
 (0)