INNER CODE UNIT · Python

fetch_changelog

jpush/jpush-react-native · .claude/skills/update-sdk/scripts/changelog_fetcher.py:24

def fetch_changelog(url: str, target_version: str) -> str:
    """Fetch and extract changelog section for target_version from a Markdown URL."""
    md_url = url if url.endswith(".md") else url + ".md"

    try:
        resp = requests.get(md_url, headers=HEADERS, timeout=30)
        resp.raise_for_status()
        content = resp.text
    except requests.RequestException as e:
        return f"ERROR: Failed to fetch {md_url}: {e}"

    lines = content.split("\n")
    in_section = False
    section_lines = []

    for line in lines:
        # Match headings like: ## JPush Android SDK v6.1.0
        if re.match(r'^##\s+.*v?' + re.escape(target_version) + r'\b', line):

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…