fix(instagram): regex capture group

This commit is contained in:
Kristofers Solo 2025-10-27 10:08:16 +02:00
parent a61bbf694f
commit 02133b79dd
Signed by: kristoferssolo
GPG Key ID: 74FF8144483D82C8

View File

@ -38,12 +38,12 @@ impl SocialHandler for InstagramHandler {
fn try_extract(&self, text: &str) -> Option<String> { fn try_extract(&self, text: &str) -> Option<String> {
shortcode_regex() shortcode_regex()
.captures(text) .captures(text)
.and_then(|c| c.get(1).map(|m| m.as_str().to_owned())) .and_then(|c| c.get(0).map(|m| m.as_str().to_owned()))
} }
async fn handle(&self, bot: &Bot, chat_id: ChatId, shortcode: String) -> Result<()> { async fn handle(&self, bot: &Bot, chat_id: ChatId, url: String) -> Result<()> {
info!(handler = %self.name(), shortcode = %shortcode, "handling instagram code"); info!(handler = %self.name(), url = %url, "handling instagram code");
let dr = download_instaloader(&shortcode).await?; let dr = download_instaloader(&url).await?;
process_download_result(bot, chat_id, dr).await process_download_result(bot, chat_id, dr).await
} }