otosky / medium_stats

Command Line and Python tool for Scraping Your Medium Stats
GNU General Public License v3.0
20 stars 5 forks source link

add optional `limit` kwarg to parameterize fetch size & handle pagination #11

Closed otosky closed 2 years ago

otosky commented 2 years ago

adding a hotfix for this minor version to enable query fetch size to be supplied as an argument, as well as finally handling Medium API response pagination

New functionality

For a User:

from medium_stats.scraper import StatGrabberUser

me = StatGrabberUser('username', sid='sid', uid='uid', start=start, stop=stop)

# fetches 50 stories per request as default, but paginates through all stories
me.get_summary_stats() 

# will fetch 1 story per request, but paginates through all stories
me.get_summary_stats(limit=1)

For a Publication:

from medium_stats.scraper import StatGrabberPublication

pub = StatGrabberPublication('slug', 'sid', 'uid', start, stop)

# fetches 50 stories per request as default, but paginates through all stories
pub.get_all_story_overview()  

# will fetch 1 story per request, but paginates through all stories
pub.get_all_story_overview(limit=1)  

contributes to #10