Skip to content

code-yeongyu/oh-my-openagent / packages/shared-skills/skills/ultimate-browsing

ultimate-browsing

Flagged

Reaches web pages the user's browser cannot open: WAF-blocked and bot-scored hosts, platform-native readers (Chinese and social platforms), archive snapshots with provenance, and a browser you own for stealth or throwaway profiles. Not for plain search, an unblocked static fetch, or a page the user's browser can open.

FileKindSize
.gitignoreother29 B
ATTRIBUTION.mdmarkdown2.5 KB
SKILL.mdskill md11.9 KB
engine/AGENTS.mdmarkdown10.8 KB
engine/__init__.pyscript668 B
engine/__main__.pyscript5.0 KB
engine/bias_check.pyscript7.1 KB
engine/curl_probe.pyscript2.4 KB
engine/executor.pyscript8.0 KB
engine/fetch_chain.pyscript13.0 KB
engine/referers.pyscript327 B
engine/result_schema.pyscript1.5 KB
engine/summary.pyscript1.2 KB
engine/surrogate.pyscript7.9 KB
engine/surrogates.yamlconfig2.3 KB
engine/templates/knip.workspace.jsoncother1.5 KB
engine/templates/package.jsonmanifest349 B
engine/templates/playwright_mobile_chrome.jsscript3.6 KB
engine/templates/playwright_real_chrome.jsscript5.5 KB
engine/tests/fixtures/amp_redirect_stub.htmlother323 B
engine/tests/fixtures/search_interstitial.htmlother90.4 KB
engine/tests/fixtures/wayback_available.jsonconfig246 B
engine/tests/fixtures/wayback_snapshot.htmlother181.4 KB
engine/tests/test_executor_timeout.pyscript6.2 KB
engine/tests/test_fetch_chain.pyscript2.7 KB
engine/tests/test_playwright_stealth.pyscript3.9 KB
engine/tests/test_playwright_templates.pyscript10.7 KB
engine/tests/test_surrogate.pyscript11.3 KB
engine/tests/test_surrogate_validators.pyscript3.5 KB
engine/url_transforms.pyscript3.2 KB
engine/validators.pyscript9.1 KB
engine/waf_detector.pyscript6.9 KB
engine/waf_profiles.yamlconfig6.2 KB
references/agent-reach/README.mdmarkdown2.2 KB
references/agent-reach/career.mdmarkdown755 B
references/agent-reach/dev.mdmarkdown1.3 KB
references/agent-reach/search.mdmarkdown821 B
references/agent-reach/social.mdmarkdown5.6 KB
references/agent-reach/video.mdmarkdown2.7 KB
references/agent-reach/web.mdmarkdown2.1 KB
references/chrome-stealth.mdmarkdown2.4 KB
references/insane-search/README.mdmarkdown20.2 KB
references/insane-search/cache-archive.mdmarkdown4.1 KB
references/insane-search/fallback.mdmarkdown6.9 KB
references/insane-search/jina.mdmarkdown4.3 KB
references/insane-search/json-api.mdmarkdown3.5 KB
references/insane-search/media.mdmarkdown3.5 KB
references/insane-search/metadata.mdmarkdown2.9 KB
references/insane-search/naver.mdmarkdown3.4 KB
references/insane-search/playwright.mdmarkdown6.8 KB
references/insane-search/public-api.mdmarkdown3.4 KB
references/insane-search/rss.mdmarkdown3.0 KB
references/insane-search/tls-impersonate.mdmarkdown6.5 KB
references/insane-search/twitter.mdmarkdown3.5 KB
scripts/cookie_crypto.pyscript2.9 KB
scripts/cookie_domains.pyscript1.1 KB
scripts/cookie_paths.pyscript3.8 KB
scripts/extract_cookies.pyscript9.4 KB
scripts/tests/test_cookie_domain_filter.pyscript3.5 KB
scripts/tests/test_extract_cookies.pyscript9.4 KB

engine/tests/test_playwright_templates.py

View on GitHub
from __future__ import annotations

import json
import os
import shutil
import subprocess
import tempfile
import textwrap
import unittest
from pathlib import Path

TEMPLATES_DIR = Path(__file__).resolve().parents[1] / "templates"
TEMPLATE_NAMES = ("playwright_real_chrome.js", "playwright_mobile_chrome.js")
JsonValue = None | bool | int | float | str | list["JsonValue"] | dict[str, "JsonValue"]


def _write_file(path: Path, content: str) -> None:
    path.parent.mkdir(parents=True, exist_ok=True)
    path.write_text(textwrap.dedent(content).lstrip(), encoding="utf-8")


def _install_fake_playwright(node_modules: Path) -> None:
    _write_file(
        node_modules / "playwright-core" / "index.js",
        """
        const page = {
          async goto() {},
          async waitForTimeout() {},
          async waitForSelector(selector) {
            if (process.env.PW_FAKE_SELECTOR_FAIL === '1') {
              throw new Error(`missing selector ${selector}`);
            }
          },
          async reload() {},
          async content() {
            return '<html><article>ok</article></html>';
          },
        };

        const context = {
          async newPage() { return page; },
          async close() {
            if (process.env.PW_FAKE_CLOSE_FAIL === '1') {
              throw new Error('close failed');
            }
          },
        };

        exports.chromium = {
          async launchPersistentContext() { return context; },
        };
        exports.devices = {
          'iPhone 13 Pro': { viewport: { width: 390, height: 844 }, userAgent: 'fake-mobile' },
        };
        """,
    )


def _install_broken_playwright_extra(node_modules: Path) -> None:
    _write_file(
        node_modules / "playwright-extra" / "index.js",
        """
        const error = new Error('stealth init failed');
        error.code = 'EACCES';
        throw error;
        """,
    )
    _write_file(
        node_modules / "puppeteer-extra-plugin-stealth" / "index.js",
        """
        module.exports = function stealth() { return {}; };
        """,
    )


def _install_working_playwright_extra(node_modules: Path) -> None:
    _write_file(
        node_modules / "playwright-extra" / "index.js",
        """
        exports.addExtra = (browserType) => browserType;
        """,
    )


def _install_playwright_extra_with_internal_missing_dependency(node_modules: Path) -> None:
    _write_file(
        node_modules / "playwright-extra" / "index.js",
        """
        require('transitive-stealth-runtime');
        """,
    )


def _install_self_missing_optional_module(node_modules: Path, module_name: str) -> None:
    _write_file(
        node_modules / module_name / "index.js",
        f"""
        const error = new Error("Cannot find module '{module_name}'");
        error.code = 'MODULE_NOT_FOUND';
        throw error;
        """,
    )


def _run_template(
    template_name: str,
    payload: dict[str, JsonValue],
    *,
    include_broken_extra: bool = False,
    include_working_extra: bool = False,
    include_internal_missing_extra: bool = False,
    include_self_missing_module: str | None = None,
    env_overrides: dict[str, str] | None = None,
) -> subprocess.CompletedProcess[str]:
    with tempfile.TemporaryDirectory(prefix="ultimate-browsing-template-test-") as tmp:
        tmp_path = Path(tmp)
        node_modules = tmp_path / "node_modules"
        _install_fake_playwright(node_modules)
        if include_working_extra:
            _install_working_playwright_extra(node_modules)
        if include_broken_extra:
            _install_broken_playwright_extra(node_modules)
        if include_internal_missing_extra:
            _install_playwright_extra_with_internal_missing_dependency(node_modules)
        if include_self_missing_module:
            _install_self_missing_optional_module(node_modules, include_self_missing_module)

        script_path = tmp_path / template_name
        script_path.write_text((TEMPLATES_DIR / template_name).read_text(encoding="utf-8"), encoding="utf-8")

        env = os.environ.copy()
        env.pop("NODE_PATH", None)
        if env_overrides:
            env.update(env_overrides)

        return subprocess.run(
            ["node", str(script_path)],
            input=json.dumps(payload),
            text=True,
            capture_output=True,
            timeout=5,
            env=env,
            check=False,
        )


@unittest.skipUnless(shutil.which("node"), "node is required for Playwright template tests")
class PlaywrightTemplateErrorHandling(unittest.TestCase):
    def test_missing_playwright_extra_warns_and_falls_back_to_playwright_core(self) -> None:
        for template_name in TEMPLATE_NAMES:
            with self.subTest(template_name=template_name):
                result = _run_template(
                    template_name,
                    {
                        "url": "https://example.com/article",
                        "profileDir": "/tmp/ultimate-browsing-test-profile",
                        "headless": True,
                    },
                )

                self.assertEqual(result.returncode, 0, result.stderr)
                self.assertIn("<article>ok</article>", result.stdout)
                self.assertIn("best-effort optional module playwright-extra failed:", result.stderr)
                self.assertIn("Cannot find module 'playwright-extra'", result.stderr)

    def test_missing_stealth_plugin_warns_and_falls_back_to_playwright_core(self) -> None:
        for template_name in TEMPLATE_NAMES:
            with self.subTest(template_name=template_name):
                result = _run_template(
                    template_name,
                    {
                        "url": "https://example.com/article",
                        "profileDir": "/tmp/ultimate-browsing-test-profile",
                        "headless": True,
                    },
                    include_working_extra=True,
                )

                self.assertEqual(result.returncode, 0, result.stderr)
                self.assertIn("<article>ok</article>", result.stdout)
                self.assertIn("best-effort optional module puppeteer-extra-plugin-stealth failed:", result.stderr)
                self.assertIn("Cannot find module 'puppeteer-extra-plugin-stealth'", result.stderr)

    def test_non_missing_stealth_dependency_error_is_not_swallowed(self) -> None:
        for template_name in TEMPLATE_NAMES:
            with self.subTest(template_name=template_name):
                result = _run_template(
                    template_name,
                    {
                        "url": "https://example.com/article",
                        "profileDir": "/tmp/ultimate-browsing-test-profile",
                        "headless": True,
                    },
                    include_broken_extra=True,
                )

                self.assertNotEqual(result.returncode, 0)
                self.assertIn("stealth init failed", result.stderr)
                self.assertNotIn("best-effort optional module", result.stderr)
                self.assertEqual(result.stdout, "")

    def test_internal_module_resolution_error_is_not_treated_as_optional_missing_dependency(self) -> None:
        for template_name in TEMPLATE_NAMES:
            with self.subTest(template_name=template_name):
                result = _run_template(
                    template_name,
                    {
                        "url": "https://example.com/article",
                        "profileDir": "/tmp/ultimate-browsing-test-profile",
                        "headless": True,
                    },
                    include_internal_missing_extra=True,
                )

                self.assertNotEqual(result.returncode, 0)
                self.assertIn("Cannot find module 'transitive-stealth-runtime'", result.stderr)
                self.assertNotIn("best-effort optional module", result.stderr)
                self.assertEqual(result.stdout, "")

    def test_present_optional_module_self_missing_error_is_not_swallowed(self) -> None:
        cases = (("playwright-extra", False), ("puppeteer-extra-plugin-stealth", True))
        for template_name in TEMPLATE_NAMES:
            for module_name, include_working_extra in cases:
                with self.subTest(template_name=template_name, module_name=module_name):
                    result = _run_template(
                        template_name,
                        {
                            "url": "https://example.com/article",
                            "profileDir": "/tmp/ultimate-browsing-test-profile",
                            "headless": True,
                        },
                        include_working_extra=include_working_extra,
                        include_self_missing_module=module_name,
                    )

                    self.assertNotEqual(result.returncode, 0)
                    self.assertIn(f"Cannot find module '{module_name}'", result.stderr)
                    self.assertNotIn("best-effort optional module", result.stderr)
                    self.assertEqual(result.stdout, "")

    def test_selector_failures_are_reported_as_best_effort_warnings(self) -> None:
        for template_name in TEMPLATE_NAMES:
            with self.subTest(template_name=template_name):
                result = _run_template(
                    template_name,
                    {
                        "url": "https://example.com/article",
                        "profileDir": "/tmp/ultimate-browsing-test-profile",
                        "headless": True,
                        "waitSelector": "article.ready",
                    },
                    env_overrides={"PW_FAKE_SELECTOR_FAIL": "1"},
                )

                self.assertEqual(result.returncode, 0, result.stderr)
                self.assertIn("<article>ok</article>", result.stdout)
                self.assertIn("best-effort waitSelector failed:", result.stderr)
                self.assertNotIn("waitSelector article.ready", result.stderr)

    def test_context_close_failures_are_reported_after_successful_html_output(self) -> None:
        for template_name in TEMPLATE_NAMES:
            with self.subTest(template_name=template_name):
                result = _run_template(
                    template_name,
                    {
                        "url": "https://example.com/article",
                        "profileDir": "/tmp/ultimate-browsing-test-profile",
                        "headless": True,
                    },
                    env_overrides={"PW_FAKE_CLOSE_FAIL": "1"},
                )

                self.assertEqual(result.returncode, 0, result.stderr)
                self.assertIn("<article>ok</article>", result.stdout)
                self.assertIn("best-effort browser context close failed:", result.stderr)


if __name__ == "__main__":
    unittest.main()
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 197kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall