Extract link IDs from a multi-line/comma-separated raw string.
(raw: str)
| 29 | |
| 30 | |
| 31 | def parse_links(raw: str) -> list[str]: |
| 32 | """Extract link IDs from a multi-line/comma-separated raw string.""" |
| 33 | link_ids = [] |
| 34 | for line in raw.replace(',', '\n').splitlines(): |
| 35 | line = line.strip() |
| 36 | if not line: |
| 37 | continue |
| 38 | # Support full URLs or just the join code |
| 39 | match = re.search(r"join/([A-Za-z0-9]+)$", line, re.I) |
| 40 | if match: |
| 41 | link_ids.append(match.group(1)) |
| 42 | elif re.fullmatch(r"[A-Za-z0-9]+", line): |
| 43 | link_ids.append(line) |
| 44 | return link_ids |
| 45 | |
| 46 | |
| 47 | async def check_status(session, key, retry=10): |