{"id":13477322,"url":"https://github.com/alanhamlett/readtime","last_synced_at":"2025-04-06T03:09:37.412Z","repository":{"id":10628468,"uuid":"66412636","full_name":"alanhamlett/readtime","owner":"alanhamlett","description":"Calculates the time some text takes the average human to read, based on Medium's read time forumula.","archived":false,"fork":false,"pushed_at":"2023-09-03T19:38:08.000Z","size":54,"stargazers_count":125,"open_issues_count":2,"forks_count":13,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-30T02:07:37.303Z","etag":null,"topics":["blog","medium","python","read-time"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/readtime/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alanhamlett.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS"}},"created_at":"2016-08-23T23:57:31.000Z","updated_at":"2025-03-08T21:30:42.000Z","dependencies_parsed_at":"2024-01-16T06:17:15.754Z","dependency_job_id":"2649cbc2-a985-4251-bd1a-a2e2166b9638","html_url":"https://github.com/alanhamlett/readtime","commit_stats":{"total_commits":57,"total_committers":2,"mean_commits":28.5,"dds":0.03508771929824561,"last_synced_commit":"7efe13b6fb9598d28285d5add762f0638cccde4c"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alanhamlett%2Freadtime","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alanhamlett%2Freadtime/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alanhamlett%2Freadtime/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alanhamlett%2Freadtime/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alanhamlett","download_url":"https://codeload.github.com/alanhamlett/readtime/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247427006,"owners_count":20937201,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blog","medium","python","read-time"],"created_at":"2024-07-31T16:01:41.126Z","updated_at":"2025-04-06T03:09:37.386Z","avatar_url":"https://github.com/alanhamlett.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# readtime\n\n[![Tests](https://img.shields.io/github/actions/workflow/status/alanhamlett/readtime/tests.yml?branch=master)](https://github.com/alanhamlett/readtime/actions/workflows/tests.yml)\n[![Coverage](https://codecov.io/gh/alanhamlett/readtime/branch/master/graph/badge.svg?token=EbUnuwbra3)](https://codecov.io/gh/alanhamlett/readtime)\n\nCalculates the time some text takes the average human to read, based on Medium's [read time formula](https://help.medium.com/hc/en-us/articles/214991667-Read-time).\n\n\n### Algorithm\n\nMedium's Help Center says,\n\n\u003e Read time is based on the average reading speed of an adult (roughly 265 WPM). We take the total word count of a post and translate it into minutes, with an adjustment made for images. For posts in Chinese, Japanese and Korean, it's a function of number of characters (500 characters/min) with an adjustment made for images.\n\nSource: https://help.medium.com/hc/en-us/articles/214991667-Read-time (Read Sept 23rd, 2018)\n\nDouble checking with real articles, the English algorithm is:\n\n    seconds = num_words / 265 * 60 + img_weight * num_images\n\nWith `img_weight` starting at `12` and decreasing one second with each image encountered, with a minium `img_weight` of `3` seconds.\n\n\n### Installation\n\n    virtualenv venv\n    . venv/bin/activate\n    pip install readtime\n\nOr if you like to live dangerously:\n\n    sudo pip install readtime\n\n\n### Usage\n\nImport `readtime` and pass it some text, HTML, or Markdown to get back the time it takes to read:\n\n    \u003e\u003e\u003e import readtime\n    \u003e\u003e\u003e result = readtime.of_text(\"The shortest blog post in the world!\")\n    \u003e\u003e\u003e result.seconds\n    2\n    \u003e\u003e\u003e result.text\n    \"1 min\"\n\nThe result can also be used as a string:\n\n    \u003e\u003e\u003e str(readtime.of_text(\"The shortest blog post in the world!\"))\n    \"1 min read\"\n\nTo calculate read time of Markdown:\n\n    \u003e\u003e\u003e readtime.of_markdown(\"This is **Markdown**\")\n    1 min read\n\nTo calculate read time of HTML:\n\n    \u003e\u003e\u003e readtime.of_html(\"This is \u003cstrong\u003eHTML\u003c/strong\u003e\")\n    1 min read\n\nTo customize the WPM (default 265):\n\n    \u003e\u003e\u003e result = readtime.of_text(\"The shortest blog post in the world!\", wpm=5)\n    \u003e\u003e\u003e result.seconds\n    96\n    \u003e\u003e\u003e result.text\n    \"2 min\"\n    \u003e\u003e\u003e result.wpm\n    5\n\n\n### Contributing\n\nBefore contributing a pull request, make sure tests pass:\n\n    virtualenv venv\n    . venv/bin/activate\n    pip install tox\n    tox\n\nMany thanks to all [contributors](https://github.com/alanhamlett/readtime/blob/master/AUTHORS)!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falanhamlett%2Freadtime","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falanhamlett%2Freadtime","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falanhamlett%2Freadtime/lists"}