﻿from pathlib import Path

news_dir = Path(r"C:\Users\poc\Downloads\WebScrapBook\data\20260429163450072\news")

articles = [
    {
        "file": "news-1.html",
        "title": "Blockstream Research Brings libsecp256k1-zkp Back Up to Speed",
        "date": "Mar 26, 2026",
        "image": "../libsecp256k1-zkp.png",
        "source": "https://blog.blockstream.com/blockstream-research-brings-libsecp256k1-zkp-back-up-to-speed/",
        "body": [
            "Blockstream Research synced libsecp256k1-zkp with about 2.5 years of upstream libsecp256k1 improvements.",
            "This impacts core Liquid cryptography: Confidential Transactions, advanced signatures, and related zero-knowledge proof operations used across the ecosystem.",
            "The update includes security hardening, faster signing/key generation, and improvements to testing and maintenance workflows.",
            "Benchmarks reported meaningful gains in ECDSA/Schnorr operations and large speedups in some MuSig2 flows.",
            "The practical result: stronger and faster cryptographic foundations for wallets, exchanges, and infrastructure built on Liquid."
        ]
    },
    {
        "file": "news-2.html",
        "title": "On-Chain Swaps and Lightning Come to the Blockstream Desktop App",
        "date": "Mar 19, 2026",
        "image": "../fullstack-16-9.jpg",
        "source": "https://blog.blockstream.com/on-chain-swaps-and-lightning-come-to-the-blockstream-desktop-app/",
        "body": [
            "Blockstream Desktop App 3.1.0 adds Lightning and swap flows directly on desktop.",
            "Users can receive Lightning payments as LBTC and pay Lightning invoices from LBTC via automatic atomic swap flows.",
            "The release also enables easier swapping between on-chain BTC and LBTC inside the app.",
            "A dedicated Jade Genuine Check section improves hardware device authenticity verification in desktop UX.",
            "Positioning of the release: full self-custody Bitcoin + Lightning + Liquid stack from one desktop app."
        ]
    },
    {
        "file": "news-3.html",
        "title": "Quantum-Resistant Transaction Signing on Liquid Using Simplicity",
        "date": "Mar 3, 2026",
        "image": "../quantum-16-9.jpg",
        "source": "https://blog.blockstream.com/blockstream-research-demonstrates-quantum-resistant-transaction-signing-on-liquid-using-simplicity-smart-contracts/",
        "body": [
            "Blockstream Research demonstrated post-quantum signature verification on Liquid using Simplicity smart contracts.",
            "The implementation introduces an opt-in protection model: users can lock assets into contracts requiring post-quantum signatures.",
            "The work uses a SHRINCS variant (hash-based signatures) with stateful mode and stateless fallback for recovery scenarios.",
            "Blockstream reported real transactions on Liquid mainnet signed with the post-quantum scheme.",
            "Important caveat from the team: this is a major building block, but not yet full network-wide quantum resistance for all components."
        ]
    },
    {
        "file": "news-4.html",
        "title": "The Risks of Expressive Smart Contracts: Lessons from the Latest Ethereum Hack",
        "date": "Feb 25, 2025",
        "image": "../ethereum_hack.jpg",
        "source": "https://blog.blockstream.com/the-risks-of-expressive-smart-contracts-lessons-from-the-latest-ethereum-hack/",
        "body": [
            "The article argues that highly expressive contract systems increase attack surface and operational complexity.",
            "It contrasts Ethereum multisig patterns (often custom contract logic) with more native and constrained approaches in Bitcoin-style systems.",
            "Key discussed risks include reentrancy, global shared state interactions, and error-prone custom multisig implementations.",
            "The piece positions simpler, auditable security primitives as preferable for critical custody paths.",
            "Main takeaway: protocol-level security design choices matter more than adding complexity later at the application layer."
        ]
    },
    {
        "file": "news-5.html",
        "title": "Confidentiality Made Affordable: ELIP 200 Unlocks Lower Fees on Liquid",
        "date": "Jan 16, 2025",
        "image": "../liquidblog-1920x1080.png",
        "source": "https://blog.blockstream.com/confidentiality-made-affordable-elip-200-unlocks-up-to-90-lower-fees-on-liquid/",
        "body": [
            "Blockstream announced Elements 23.2.5 and ELIP 200 deployment on Liquid mainnet.",
            "The fee policy significantly reduces costs for Confidential Transactions, with examples showing large fee drops.",
            "The goal is to improve affordability of private transfers and increase competitiveness for practical payment and settlement use cases.",
            "The release also references explorer and seed-node updates plus ecosystem/dev initiatives around Liquid adoption.",
            "Bottom line: lower CT fees make privacy-preserving Liquid usage more accessible to end users and builders."
        ]
    },
]

css = """
body{margin:0;background:#0c0c0f;color:#fff;font-family:Inter,Arial,sans-serif}
main{max-width:920px;margin:40px auto;padding:0 20px 50px}
.back{display:inline-block;margin-bottom:20px;color:#00c3ff;text-decoration:none}
h1{font-size:34px;line-height:1.2;margin:0 0 6px}
.meta{color:#9aa7b0;font-size:14px;margin-bottom:16px}
img{width:100%;border-radius:12px;margin:8px 0 24px;background:#111}
p{color:#d8e1e6;font-size:18px;line-height:1.65;margin:0 0 14px}
.source{margin-top:22px;font-size:14px;color:#9aa7b0}
.source a{color:#00c3ff}
"""

for a in articles:
    paragraphs = "\n".join(f"<p>{t}</p>" for t in a["body"])
    html = f"""<!doctype html>
<html lang=\"en\"><head>
<meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">
<title>{a['title']}</title>
<style>{css}</style>
</head><body><main>
<a class=\"back\" href=\"../index.html\">← Back to home</a>
<h1>{a['title']}</h1>
<div class=\"meta\">{a['date']}</div>
<img src=\"{a['image']}\" alt=\"{a['title']}\">
{paragraphs}
<div class=\"source\">Source: <a href=\"{a['source']}\" target=\"_blank\" rel=\"noopener\">original article</a></div>
</main></body></html>"""
    (news_dir / a["file"]).write_text(html, encoding="utf-8")

print("rewritten", len(articles), "files")
