Diff

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
parent 4252:1327e1e1c94e
child 4255:38da10e4b593
line wrap: on
line diff
--- a/mod_ogp/mod_ogp.lua	Tue Nov 17 13:45:33 2020 +0100
+++ b/mod_ogp/mod_ogp.lua	Wed Nov 18 11:16:11 2020 +0100
@@ -2,8 +2,8 @@
 local http = require "net.http"
 local st = require "util.stanza"
 
-local ogp_pattern = [[<meta property=["'](og:.-)["'] content=["'](.-)["'].->]]
-local ogp_pattern2 = [[<meta content=["'](.-)["'] property=["'](og:.-)["'].->]]
+local ogp_pattern = [[<meta property=["']?(og:.-)["']? content=%s*["']?(.-)["']?%s-/?>]]
+local ogp_pattern2 = [[<meta content=%s*["']?(.-)["']? property=["']?(og:.-)["']?%s-/?>]]
 local url_pattern = [[https?://%S+]]
 
 local function ogp_handler(event)