{"name":"micawber: A Python Library for Extracting Rich Content from URLs","description":"micawber is a lightweight Python library designed to extract rich content from various URLs, leveraging the oEmbed standard. It provides methods to retrieve metadata and embed codes for services like YouTube and Flickr. This library simplifies the process of displaying embedded media and rich previews in web applications.","github":"https://github.com/coleifer/micawber","url":"https://osrepos.com/repo/coleifer-micawber","source":"osrepos.com","sourceDescription":"This repository profile is provided by osrepos.com, an open source repository discovery platform.","repositoryProfile":"https://osrepos.com/repo/coleifer-micawber","generatedFor":"open source discovery and AI-assisted research","markdown":"https://osrepos.com/repo/coleifer-micawber.md","json":"https://osrepos.com/repo/coleifer-micawber.json","topics":["oembed","python","url parsing","media embedding","content extraction","web development"],"keywords":["oembed","python","url parsing","media embedding","content extraction","web development"],"stars":null,"summary":"micawber is a lightweight Python library designed to extract rich content from various URLs, leveraging the oEmbed standard. It provides methods to retrieve metadata and embed codes for services like YouTube and Flickr. This library simplifies the process of displaying embedded media and rich previews in web applications.","content":"## Introduction\n`micawber` is a lightweight Python library developed by `coleifer` designed to simplify the extraction of rich content from various URLs. It leverages the oEmbed standard to retrieve metadata and embed codes for links to services like YouTube, Flickr, and many others. This makes it ideal for applications that need to display embedded media or rich previews from external sources.\n\n## Installation\nTo get started with `micawber`, you can easily install it using pip:\n\nbash\npip install micawber\n\n\n## Examples\nThe library provides straightforward methods for requesting oEmbed data and parsing text or HTML to automatically embed content.\n\nHere's a quick example of how to use `micawber` to retrieve information for a YouTube video:\n\npython\nimport micawber\n\n# Load up rules for some default providers, such as YouTube and Flickr\nproviders = micawber.bootstrap_basic()\n\n# Request data for a specific URL\ndata = providers.request('http://www.youtube.com/watch?v=54XHDUOHuzU')\nprint(data)\n# Expected output (dictionary containing video metadata and HTML embed code):\n# {\n#     'author_name': 'pascalbrax',\n#     'author_url': 'http://www.youtube.com/user/pascalbrax',\n#     'height': 344,\n#     'html': '<iframe width=\"459\" height=\"344\" src=\"http://www.youtube.com/embed/54XHDUOHuzU?fs=1&feature=oembed\" frameborder=\"0\" allowfullscreen></iframe>',\n#     'provider_name': 'YouTube',\n#     'provider_url': 'http://www.youtube.com/',\n#     'title': 'Future Crew - Second Reality demo - HD',\n#     'type': 'video',\n#     'thumbnail_height': 360,\n#     'thumbnail_url': 'http://i2.ytimg.com/vi/54XHDUOHuzU/hqdefault.jpg',\n#     'thumbnail_width': 480,\n#     'url': 'http://www.youtube.com/watch?v=54XHDUOHuzU',\n#     'width': 459,\n#     'version': '1.0',\n# }\n\n\nYou can also parse text or HTML to automatically replace URLs with their embedded content:\n\npython\n# Parse text\nparsed_text = providers.parse_text('this is a test:\\nhttp://www.youtube.com/watch?v=54XHDUOHuzU')\nprint(parsed_text)\n# Expected output:\n# this is a test:\n# <iframe width=\"459\" height=\"344\" src=\"http://www.youtube.com/embed/54XHDUOHuzU?fs=1&feature=oembed\" frameborder=\"0\" allowfullscreen></iframe>\n\n\npython\n# Parse HTML\nparsed_html = providers.parse_html('<p>http://www.youtube.com/watch?v=54XHDUOHuzU</p>')\nprint(parsed_html)\n# Expected output:\n# <p><iframe width=\"459\" height=\"344\" src=\"http://www.youtube.com/embed/54XHDUOHuzU?fs=1&amp;feature=oembed\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"></iframe></p>\n\n\n## Why Use `micawber`?\n`micawber` simplifies the complex task of integrating rich media from external services into your applications. By abstracting the oEmbed protocol, it allows developers to quickly add features like video embedding, image previews, and rich link summaries with minimal code. Its ability to parse both plain text and HTML makes it versatile for various content management and display scenarios.\n\n## Links\nFor more detailed information, documentation, and to contribute, visit the official GitHub repository:\n*   [micawber GitHub Repository](https://github.com/coleifer/micawber){:target=\"_blank\"}","metrics":{"detailViews":3,"githubClicks":1},"dates":{"published":null,"modified":"2026-07-25T12:11:52.000Z"}}