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