fix: extract Teams URL via regex to support 'Teilnahmeinfos kopieren' format
This commit is contained in:
parent
83642b2b8d
commit
3a993bc741
19
main.py
19
main.py
@ -10,10 +10,13 @@ Post !start "Presenter Name" and !stop in the chat to define a time window.
|
||||
A Markdown memo is saved to the current directory when the window closes.
|
||||
"""
|
||||
import platform
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
_TEAMS_URL_RE = re.compile(r'https://teams(?:\.live)?\.microsoft\.com/\S+')
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).parent / "src"))
|
||||
|
||||
from playwright.sync_api import sync_playwright
|
||||
@ -44,17 +47,23 @@ def _read_clipboard() -> str:
|
||||
return ""
|
||||
|
||||
|
||||
def _extract_teams_url(text: str) -> str | None:
|
||||
m = _TEAMS_URL_RE.search(text)
|
||||
return m.group(0) if m else None
|
||||
|
||||
|
||||
def _get_meeting_url() -> str | None:
|
||||
if len(sys.argv) > 1:
|
||||
url = sys.argv[1].strip()
|
||||
if "teams.microsoft.com" in url or "teams.live.com" in url:
|
||||
url = _extract_teams_url(sys.argv[1])
|
||||
if url:
|
||||
print(f"Meeting-URL aus Argument: {url[:60]}...")
|
||||
return url
|
||||
|
||||
clip = _read_clipboard()
|
||||
if "teams.microsoft.com" in clip or "teams.live.com" in clip:
|
||||
print(f"Meeting-URL aus Clipboard: {clip[:60]}...")
|
||||
return clip
|
||||
url = _extract_teams_url(clip)
|
||||
if url:
|
||||
print(f"Meeting-URL aus Clipboard: {url[:60]}...")
|
||||
return url
|
||||
|
||||
return None
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user