micawber


Namemicawber JSON
Version 0.5.5 PyPI version JSON
download
home_pagehttp://github.com/coleifer/micawber/
Summarya small library for extracting rich content from urls
upload_time2023-06-19 13:23:05
maintainerNone
docs_urlNone
authorCharles Leifer
requires_pythonNone
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            .. image:: http://media.charlesleifer.com/blog/photos/micawber-logo-0.png

A small library for extracting rich content from urls.


what does it do?
----------------

micawber supplies a few methods for retrieving rich metadata about a variety of
links, such as links to youtube videos.  micawber also provides functions for
parsing blocks of text and html and replacing links to videos with rich embedded
content.

examples
--------

here is a quick example:

.. code-block:: python

    import micawber

    # load up rules for some default providers, such as youtube and flickr
    providers = micawber.bootstrap_basic()

    providers.request('http://www.youtube.com/watch?v=54XHDUOHuzU')

    # returns the following dictionary:
    {
        'author_name': 'pascalbrax',
        'author_url': u'http://www.youtube.com/user/pascalbrax'
        'height': 344,
        'html': u'<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': u'video',
        'thumbnail_height': 360,
        'thumbnail_url': u'http://i2.ytimg.com/vi/54XHDUOHuzU/hqdefault.jpg',
        'thumbnail_width': 480,
        'url': 'http://www.youtube.com/watch?v=54XHDUOHuzU',
        'width': 459,
        'version': '1.0',
    }

    providers.parse_text('this is a test:\nhttp://www.youtube.com/watch?v=54XHDUOHuzU')

    # returns the following string:
    this is a test:
    <iframe width="459" height="344" src="http://www.youtube.com/embed/54XHDUOHuzU?fs=1&feature=oembed" frameborder="0" allowfullscreen></iframe>

    providers.parse_html('<p>http://www.youtube.com/watch?v=54XHDUOHuzU</p>')

    # returns the following html:
    <p><iframe width="459" height="344" src="http://www.youtube.com/embed/54XHDUOHuzU?fs=1&amp;feature=oembed" frameborder="0" allowfullscreen="allowfullscreen"></iframe></p>

            

Raw data

            {
    "_id": null,
    "home_page": "http://github.com/coleifer/micawber/",
    "name": "micawber",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "Charles Leifer",
    "author_email": "coleifer@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/ab/19/d72a97f879f6635ca61e699ff0104a62b8be1d46cc21bd904d07a338b6bf/micawber-0.5.5.tar.gz",
    "platform": null,
    "description": ".. image:: http://media.charlesleifer.com/blog/photos/micawber-logo-0.png\n\nA small library for extracting rich content from urls.\n\n\nwhat does it do?\n----------------\n\nmicawber supplies a few methods for retrieving rich metadata about a variety of\nlinks, such as links to youtube videos.  micawber also provides functions for\nparsing blocks of text and html and replacing links to videos with rich embedded\ncontent.\n\nexamples\n--------\n\nhere is a quick example:\n\n.. code-block:: python\n\n    import micawber\n\n    # load up rules for some default providers, such as youtube and flickr\n    providers = micawber.bootstrap_basic()\n\n    providers.request('http://www.youtube.com/watch?v=54XHDUOHuzU')\n\n    # returns the following dictionary:\n    {\n        'author_name': 'pascalbrax',\n        'author_url': u'http://www.youtube.com/user/pascalbrax'\n        'height': 344,\n        'html': u'<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': u'video',\n        'thumbnail_height': 360,\n        'thumbnail_url': u'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    providers.parse_text('this is a test:\\nhttp://www.youtube.com/watch?v=54XHDUOHuzU')\n\n    # returns the following string:\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    providers.parse_html('<p>http://www.youtube.com/watch?v=54XHDUOHuzU</p>')\n\n    # returns the following html:\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",
    "bugtrack_url": null,
    "license": null,
    "summary": "a small library for extracting rich content from urls",
    "version": "0.5.5",
    "project_urls": {
        "Homepage": "http://github.com/coleifer/micawber/"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ab19d72a97f879f6635ca61e699ff0104a62b8be1d46cc21bd904d07a338b6bf",
                "md5": "801b87ce0bb87026d761e8b0eebc6116",
                "sha256": "0ac5814b65ff2a781fb1394b91a23a8a95f73492b6bb8f705baeead82eadd543"
            },
            "downloads": -1,
            "filename": "micawber-0.5.5.tar.gz",
            "has_sig": false,
            "md5_digest": "801b87ce0bb87026d761e8b0eebc6116",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 18863,
            "upload_time": "2023-06-19T13:23:05",
            "upload_time_iso_8601": "2023-06-19T13:23:05.786354Z",
            "url": "https://files.pythonhosted.org/packages/ab/19/d72a97f879f6635ca61e699ff0104a62b8be1d46cc21bd904d07a338b6bf/micawber-0.5.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-19 13:23:05",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "coleifer",
    "github_project": "micawber",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "micawber"
}
        
Elapsed time: 0.09765s