- Fix in Pocket, wenn kein Titel vorhanden
- Fixe YouTube-Patterns
This commit is contained in:
parent
f35b693349
commit
51b13df77f
@ -72,7 +72,7 @@ function pocket:add_pocket_item(access_token, url)
|
|||||||
local result = post_petition(BASE_URL..'/add', 'consumer_key='..consumer_key..'&access_token='..access_token..'&url='..url, headers)
|
local result = post_petition(BASE_URL..'/add', 'consumer_key='..consumer_key..'&access_token='..access_token..'&url='..url, headers)
|
||||||
if result.status ~= 1 then return 'Ein Fehler beim Hinzufügen der URL ist aufgetreten :(' end
|
if result.status ~= 1 then return 'Ein Fehler beim Hinzufügen der URL ist aufgetreten :(' end
|
||||||
local given_url = result.item.given_url
|
local given_url = result.item.given_url
|
||||||
if result.item.title == "" then
|
if result.item.title == "" or not result.item.title then
|
||||||
title = 'Seite'
|
title = 'Seite'
|
||||||
else
|
else
|
||||||
title = '"'..result.item.title..'"'
|
title = '"'..result.item.title..'"'
|
||||||
|
@ -14,6 +14,7 @@ function youtube:init(config)
|
|||||||
|
|
||||||
youtube.triggers = {
|
youtube.triggers = {
|
||||||
'youtu.be/([A-Za-z0-9-_-]+)',
|
'youtu.be/([A-Za-z0-9-_-]+)',
|
||||||
|
'youtube.com/embed/([A-Za-z0-9-_-]+)',
|
||||||
'youtube.com/watch%?v=([A-Za-z0-9-_-]+)'
|
'youtube.com/watch%?v=([A-Za-z0-9-_-]+)'
|
||||||
}
|
}
|
||||||
youtube.doc = [[*YouTube-Link*: Postet Infos zu Video]]
|
youtube.doc = [[*YouTube-Link*: Postet Infos zu Video]]
|
||||||
@ -148,13 +149,8 @@ function send_youtube_data(data, msg, self, link, sendpic)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function youtube:action(msg)
|
function youtube:action(msg, config, matches)
|
||||||
if not msg.text:match('youtu.be/([A-Za-z0-9-_-]+)') and not msg.text:match('youtube.com/watch%?v=([A-Za-z0-9-_-]+)') then
|
local yt_code = matches[1]
|
||||||
return
|
|
||||||
end
|
|
||||||
local yt_code = msg.text:match('youtu.be/([A-Za-z0-9-_-]+)')
|
|
||||||
if not yt_code then yt_code = msg.text:match('youtube.com/watch%?v=([A-Za-z0-9-_-]+)') end
|
|
||||||
|
|
||||||
local data = get_yt_data(yt_code)
|
local data = get_yt_data(yt_code)
|
||||||
send_youtube_data(data, msg, self)
|
send_youtube_data(data, msg, self)
|
||||||
return
|
return
|
||||||
|
Reference in New Issue
Block a user