Browse Source

invidious regexp multiline

master Final_old_sdk
nemesis 3 years ago
parent
commit
685381a86f
  1. 4
      asmodee.py

4
asmodee.py

@ -2056,7 +2056,7 @@ def titre(room, event): # cherche le titre d'une page
else: else:
msg(room,"Titre non trouvé",event['sender']) msg(room,"Titre non trouvé",event['sender'])
if (re.search(r"http[s]?://(www\.)?youtube\.",url) is not None and modules[room.room_id, 'invidious'] is False and not event['sender'] == bot.client.user_id): if (re.search(r"http[s]?://(www\.)?youtube\.",url) is not None and modules[room.room_id, 'invidious'] is False and not event['sender'] == bot.client.user_id):
res = re.sub(r"^.*\?v=(\w+).*$", r"\1", url) res = re.sub(r"^.*\?v=(\w+).*$", r"\1", url, 0, re.MULTILINE)
msg(room,str("https://invidious.fdn.fr/watch?v=" + res),event['sender']) msg(room,str("https://invidious.fdn.fr/watch?v=" + res),event['sender'])
except: except:
msg(room,"URL invalide",event['sender']) msg(room,"URL invalide",event['sender'])
@ -2071,7 +2071,7 @@ def invidious(room, event): # convertit un lien youtube en lien invidious
if (modules[room.room_id, 'invidious'] and not event['sender'] == bot.client.user_id): if (modules[room.room_id, 'invidious'] and not event['sender'] == bot.client.user_id):
url = event['content']['body'] url = event['content']['body']
try: try:
res = re.sub(r"^.*\?v=(\w+).*$", r"\1", url) res = re.sub(r"^.*\?v=(\w+).*$", r"\1", url, 0, re.MULTILINE)
msg(room,str("Une alternative pour cette video : https://invidious.fdn.fr/watch?v=" + res),event['sender']) msg(room,str("Une alternative pour cette video : https://invidious.fdn.fr/watch?v=" + res),event['sender'])
except: except:
msg(room,"URL invalide",event['sender']) msg(room,"URL invalide",event['sender'])

Loading…
Cancel
Save