INNER CODE UNIT · Python

parse_links

pluwen/awesome-testflight-link · scripts/batch_add_link.py:24

def parse_links(raw: str) -> list[str]:
    """Extract link IDs from a multi-line/comma-separated raw string."""
    link_ids = []
    for line in raw.replace(',', '\n').splitlines():
        line = line.strip()
        if not line:
            continue
        # Support full URLs or just the join code
        match = re.search(r"join/([A-Za-z0-9]+)$", line, re.I)
        if match:
            link_ids.append(match.group(1))
        elif re.fullmatch(r"[A-Za-z0-9]+", line):
            link_ids.append(line)
    return link_ids


async def main():
    args = sys.argv[1:]

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…