Skip to main content

Medium Muncher

Medium makes content readily available for machine consumption through the format=json param, and content feeds via the feeds path, however the XML and JSON responses are not exactly plug-and-play for redisplaying content. Enter this package.

Installation

via pip with

pip3 install mediummuncher

Usage

Getting a story as stand-alone HTML (with head and body tags)

from medium_muncher import MediumMuncher

muncher = MediumMuncher()
full_html=muncher.munch_story('https://medium.com/some-author/some-amazing-article-039525')
#returns "<!doctype html><head>... "

Getting a story as an html snippet (no head or body)

html_snippet=muncher.munch_story('https://medium.com/some-author/some-amazing-article-039525',snippet=True)
#returns "<p>article text!..."

Using the verbose flag returns a tuple with the html and a dictionary of interesting article attributes such as title, published date etc.

html_snippet=muncher.munch_story('https://medium.com/some-author/some-amazing-article-039525',snippet=True, verbose=True)
#returns tuple ("<p>article text!...", {"title":"this amazing article"...,)

Getting all the story urls for a given author

stories=muncher.munch_author_feed('some-author')
#returns tuple ("https://medium.com/some-author/amazing-article-one-12902990",..,) 

Putting it all together to extract all stories for a given author

stories=list()
for url in muncher.munch_author_feed('ethan.m.knox'):
    stories.append(muncher.munch_story( url,
                                        snippet=True,
                                        verbose=True))
print(list)

Contributing

Please feel free to fork and PR! Can always use another helping hand.

Release files for mediumMuncher 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mediumMuncher 0.2.0
File Size Uploaded
mediumMuncher-0.2.0.tar.gz 3.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mediumMuncher 0.2.0
File Interpreter ABI Platform
mediumMuncher-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.2 kB

Release files / mediumMuncher-0.2.0.tar.gz

Download URL mediumMuncher-0.2.0.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ca62a5853a1eaca90dfd97f47ba8d14357360dbb2bbda60eebca593cc8872daf
BLAKE2b-256 checksum
How to use checksums
23938ec95dd21c66e1d90716b3553f51c29d477c54c95a2dac31885a0f274a64
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.40.1 CPython/3.7.3

Release files / mediumMuncher-0.2.0-py3-none-any.whl

Download URL mediumMuncher-0.2.0-py3-none-any.whl
Size 4.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aeb4416dffe266d0ac674070b8a51d3fb6b40832728f3f304c40d256ef7d6c36
BLAKE2b-256 checksum
How to use checksums
787a601e84a1d0be89b0c8bb11760748a58256c2adb5cdc16c1cba82c5a6d2ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.40.1 CPython/3.7.3

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.10

2 release files

0.1.0

3 release files

0.0.3

3 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page