mirror of
https://github.com/aljazceru/chatgpt-telegram-bot.git
synced 2025-12-22 15:14:54 +01:00
refactor: add url preloading before actual download
This commit is contained in:
@@ -29,6 +29,11 @@ class WebshotPlugin(Plugin):
|
||||
async def execute(self, function_name, **kwargs) -> Dict:
|
||||
try:
|
||||
image_url = f'https://image.thum.io/get/maxAge/12/width/720/{kwargs["url"]}'
|
||||
|
||||
# preload url first
|
||||
requests.get(image_url)
|
||||
|
||||
# download the actual image
|
||||
response = requests.get(image_url, timeout=30)
|
||||
|
||||
if response.status_code == 200:
|
||||
|
||||
Reference in New Issue
Block a user