# micawber: A Python Library for Extracting Rich Content from URLs

This repository profile is provided by osrepos.com, an open source repository discovery platform.

Source: osrepos.com
Repository profile: https://osrepos.com/repo/coleifer-micawber
Generated for open source discovery and AI-assisted research.

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
OSRepos URL: https://osrepos.com/repo/coleifer-micawber

## 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.

## Topics

- oembed
- python
- url parsing
- media embedding
- content extraction
- web development

## Repository Information

Last analyzed by OSRepos: Sat Jul 25 2026 13:11:52 GMT+0100 (Western European Summer Time)
Detail views: 3
GitHub clicks: 1

## Safety Notice

OSRepos shares public repositories for knowledge and discovery only. Review source code, dependencies, licenses, and security implications before running or installing anything.

## Content

## Introduction
`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.

## Installation
To get started with `micawber`, you can easily install it using pip:

bash
pip install micawber


## Examples
The library provides straightforward methods for requesting oEmbed data and parsing text or HTML to automatically embed content.

Here's a quick example of how to use `micawber` to retrieve information for a YouTube video:

python
import micawber

# Load up rules for some default providers, such as YouTube and Flickr
providers = micawber.bootstrap_basic()

# Request data for a specific URL
data = providers.request('http://www.youtube.com/watch?v=54XHDUOHuzU')
print(data)
# Expected output (dictionary containing video metadata and HTML embed code):
# {
#     'author_name': 'pascalbrax',
#     'author_url': 'http://www.youtube.com/user/pascalbrax',
#     'height': 344,
#     'html': '<iframe width="459" height="344" src="http://www.youtube.com/embed/54XHDUOHuzU?fs=1&feature=oembed" frameborder="0" allowfullscreen></iframe>',
#     'provider_name': 'YouTube',
#     'provider_url': 'http://www.youtube.com/',
#     'title': 'Future Crew - Second Reality demo - HD',
#     'type': 'video',
#     'thumbnail_height': 360,
#     'thumbnail_url': 'http://i2.ytimg.com/vi/54XHDUOHuzU/hqdefault.jpg',
#     'thumbnail_width': 480,
#     'url': 'http://www.youtube.com/watch?v=54XHDUOHuzU',
#     'width': 459,
#     'version': '1.0',
# }


You can also parse text or HTML to automatically replace URLs with their embedded content:

python
# Parse text
parsed_text = providers.parse_text('this is a test:\nhttp://www.youtube.com/watch?v=54XHDUOHuzU')
print(parsed_text)
# Expected output:
# this is a test:
# <iframe width="459" height="344" src="http://www.youtube.com/embed/54XHDUOHuzU?fs=1&feature=oembed" frameborder="0" allowfullscreen></iframe>


python
# Parse HTML
parsed_html = providers.parse_html('<p>http://www.youtube.com/watch?v=54XHDUOHuzU</p>')
print(parsed_html)
# Expected output:
# <p><iframe width="459" height="344" src="http://www.youtube.com/embed/54XHDUOHuzU?fs=1&amp;feature=oembed" frameborder="0" allowfullscreen="allowfullscreen"></iframe></p>


## Why Use `micawber`?
`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.

## Links
For more detailed information, documentation, and to contribute, visit the official GitHub repository:
*   [micawber GitHub Repository](https://github.com/coleifer/micawber){:target="_blank"}