comparison src/lib/Bbcode.luan @ 27:6871eec2cf4c

add rumble
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 21 Jul 2022 00:01:46 -0600
parents cdcd1b70c15e
children d9d7aa2a79db
comparison
equal deleted inserted replaced
26:0837820b97fb 27:6871eec2cf4c
102 end 102 end
103 103
104 local youtube_ptn1 = [[https://youtu.be/([a-zA-Z0-9_-]+)(?:\?t=([0-9]+))?]] 104 local youtube_ptn1 = [[https://youtu.be/([a-zA-Z0-9_-]+)(?:\?t=([0-9]+))?]]
105 local youtube_ptn2 = [[https://www.youtube.com/watch\?v=([a-zA-Z0-9_-]+)(?:&t=([0-9]+)s)?]] 105 local youtube_ptn2 = [[https://www.youtube.com/watch\?v=([a-zA-Z0-9_-]+)(?:&t=([0-9]+)s)?]]
106 local bitchute_ptn = [[https://www.bitchute.com/video/([a-zA-Z0-9]+)/]] 106 local bitchute_ptn = [[https://www.bitchute.com/video/([a-zA-Z0-9]+)/]]
107 local rumble_ptn = [[https://rumble.com/embed/[a-z0-9]+/\?pub=[a-z0-9]+]]
107 108
108 function html.video(bbcode,options) 109 function html.video(bbcode,options)
109 local url = bbcode.contents 110 local url = bbcode.contents
110 local id, start = match(url,youtube_ptn1) 111 local id, start = match(url,youtube_ptn1)
111 if id == nil then 112 if id == nil then
120 return 121 return
121 end 122 end
122 id = match(url,bitchute_ptn) 123 id = match(url,bitchute_ptn)
123 if id ~= nil then 124 if id ~= nil then
124 %><iframe width="560" height="315" scrolling="no" frameborder="0" style="border: none;" src="https://www.bitchute.com/embed/<%=id%>/"></iframe><% 125 %><iframe width="560" height="315" scrolling="no" frameborder="0" style="border: none;" src="https://www.bitchute.com/embed/<%=id%>/"></iframe><%
126 return
127 end
128 if matches(url,rumble_ptn) then
129 %><iframe width="560" height="315" frameborder="0" allowfullscreen src="<%=url%>"></iframe><%
125 return 130 return
126 end 131 end
127 url = html_encode(url) 132 url = html_encode(url)
128 %><a href="<%=url%>"><%=url%></a><% 133 %><a href="<%=url%>"><%=url%></a><%
129 end 134 end