url = 'https://aliexpress.ru/item/1005003155920016.html?gps-id=6030001&pdp_ext_f=%7B%22sku_id%22%3A%2212000025078666249%22%2C%22ship_from%22%3A%22RU%22%7D&pvid=d131c25b-e4f5-47e8-a0e4-e2eec26162d2&scm=1007.23886.125299.0&scm-url=1007.23886.125299.0&scm_id=1007.23886.125299.0&sku_id=12000025078666247&spm=a2g2w.home.15003.3.75df501dsHLWdB'
for i in url.split('?', 1)[1].split('&'):
k, v = i.split('=')
match k:
case 'sku_id': # что-то делаем
@bot.message_handler(content_types='text')
def message_reply(message):
text = message.text
if 'amazon' in text:
try:
product_id = text.split('/', 6)[5]
bot.send_message(message.chat.id, f'Amazon - *{product_id}*')
except Exception:
bot.send_message(message.chat.id, 'Не верная ссылка')
else:
bot.send_message(message.chat.id, 'Не известная ссылка')