Mercurial > prosody-modules
comparison mod_ogp/mod_ogp.lua @ 4254:a4e182d7ff0a
mod_ogp: Improve parsing patterns
author | Seve Ferrer <seve@delape.net> |
---|---|
date | Wed, 18 Nov 2020 11:16:11 +0100 |
parents | 1327e1e1c94e |
children | 38da10e4b593 |
comparison
equal
deleted
inserted
replaced
4253:32b4901a9d8d | 4254:a4e182d7ff0a |
---|---|
1 local mod_muc = module:depends("muc") | 1 local mod_muc = module:depends("muc") |
2 local http = require "net.http" | 2 local http = require "net.http" |
3 local st = require "util.stanza" | 3 local st = require "util.stanza" |
4 | 4 |
5 local ogp_pattern = [[<meta property=["'](og:.-)["'] content=["'](.-)["'].->]] | 5 local ogp_pattern = [[<meta property=["']?(og:.-)["']? content=%s*["']?(.-)["']?%s-/?>]] |
6 local ogp_pattern2 = [[<meta content=["'](.-)["'] property=["'](og:.-)["'].->]] | 6 local ogp_pattern2 = [[<meta content=%s*["']?(.-)["']? property=["']?(og:.-)["']?%s-/?>]] |
7 local url_pattern = [[https?://%S+]] | 7 local url_pattern = [[https?://%S+]] |
8 | 8 |
9 local function ogp_handler(event) | 9 local function ogp_handler(event) |
10 local room, stanza = event.room, st.clone(event.stanza) | 10 local room, stanza = event.room, st.clone(event.stanza) |
11 local body = stanza:get_child_text("body") | 11 local body = stanza:get_child_text("body") |