{"id":20224915,"url":"https://github.com/adwaith-rajesh/py-mediastack","last_synced_at":"2025-08-20T12:12:52.653Z","repository":{"id":62581663,"uuid":"403832969","full_name":"Adwaith-Rajesh/py-mediastack","owner":"Adwaith-Rajesh","description":"An unofficial python helper package to interact with the mediastack API.","archived":false,"fork":false,"pushed_at":"2021-09-07T09:58:37.000Z","size":12,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-14T12:57:44.663Z","etag":null,"topics":["api","mediastack","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Adwaith-Rajesh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-09-07T03:52:42.000Z","updated_at":"2024-06-15T12:39:04.000Z","dependencies_parsed_at":"2022-11-03T21:35:34.251Z","dependency_job_id":null,"html_url":"https://github.com/Adwaith-Rajesh/py-mediastack","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Adwaith-Rajesh%2Fpy-mediastack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Adwaith-Rajesh%2Fpy-mediastack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Adwaith-Rajesh%2Fpy-mediastack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Adwaith-Rajesh%2Fpy-mediastack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Adwaith-Rajesh","download_url":"https://codeload.github.com/Adwaith-Rajesh/py-mediastack/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241663362,"owners_count":19999307,"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":["api","mediastack","python"],"created_at":"2024-11-14T07:09:48.880Z","updated_at":"2025-03-03T12:27:22.444Z","avatar_url":"https://github.com/Adwaith-Rajesh.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# py-mediastack\n\nAn unofficial python helper package to interact with the mediastack API.\n\n## Drawbacks\n\n- No historical Data (I don't have a paid account to test it)\n- No News Sources search (I don't have time to implement it)\n\nFeel free to contribute. Make sure that you use the `pre-commit` hooks.\n\n## What can it do ?\n\nIt can give you live news updated.\n\n## Installation\n\n```commandline\npip3 install py-mediastack\n```\n\n## Usage\n\n### Get the api key from [here](https://mediastack.com/)\n\n```python\nfrom mediastack import MediaStack\nclient = MediaStack(\"\u003cyour-api-key\u003e\")\n\nresp = client.get_live_news()\n\nprint(resp.pagination)\nprint(resp.data[0])\n\n```\n\n```\nPagination(limit=25, offset=0, count=25, total=10000)\n\nArticle(author='Redazione', title='Via agli incontri di quartiere:\nprimo appuntamento con i residenti di San Lorenzo',\ndescription='Hanno preso il via ieri sera, dalla sala Biasin dove l’Amministrazione ha convocato i residenti del quartiere San Lorenzo, gli ‘Incontri di quartiere’ con cui la Giunta si confronta con i cittadini. Presenti, oltre al Sindaco Gian Francesco Menani, il vicesindaco Camilla Nizzoli e gli assessori Corrado Ruini e Massimo Malagoli, che hanno ascoltato le [\u0026#8230;]',\nurl='https://www.bologna2000.com/2021/09/07/via-agli-incontri-di-quartiere-primo-appuntamento-con-i-residenti-di-san-lorenzo/',\nimage=None,\ncategory='general',\nlanguage='it',\n country='it',\n published_at='2021-09-07T08:32:52+00:00',\n source='bologna2000')\n```\n\n---\n\nThe parameters for `MediaStack.get_live_news` are as follow:\n\n- `sources`: `Optional[list[str]]` -\u003e Use this parameter to include or exclude one or multiple news sources. Example: To include CNN, but exclude BBC: `sources=[\"cnn\", \"-bbc\"]`\n\n- `categories`: `Optional[list[str]]` Use this parameter to include or exclude one or multiple news categories. Example: To include business, but exclude sports: `categories=[\"business\", \"-sports\"]`.\n\n- `countries`: `Optional[list[str]]` -\u003e Use this parameter to include or exclude one or multiple countries. Example: To include Australia, but exclude the US: `countries=[\"au\", \"-us\"]`.\n\n- `languages`: `Optional[list[str]]` -\u003e Use this parameter to include or exclude one or multiple languages. Example: To include English, but exclude German: `languages=[\"en\", \"-de\"]`.\n\n- `keywords`: `Optional[str]` -\u003e Use this parameter to search for sentences, you can also exclude words that you do not want to appear in your search results. Example: To search for \"New movies 2021\" but exclude \"Matrix\": `keywords='new movies 2021 -matrix'`\n- `date`: `Optional[str]` -\u003e Use this parameter to specify a date or date range. Example: `date=2020-01-01` for news on Jan 1st and `date='2020-12-24,2020-12-31'` for news between Dec 24th and 31st.\n- `sort`: `Optional[str]` -\u003e Use this parameter to specify a sorting order. Available values: `published_desc` (default), `published_asc`, `popularity`\n- `limit`: `Optional[int]` -\u003e Use this parameter to specify a pagination limit (number of results per page) for your API request. Default limit value is 25, maximum allowed limit value is 100.\n- `offset`: `Optional[int]` -\u003e Use this parameter to specify a pagination offset value for your API request. Example: An offset value of 100 combined with a limit value of 10 would show results 100-110. Default value is 0, starting with the first available result.\n\n---\n\nThe `get_live_news` methods returns a `LiveNewsResponse` data class.\nIt contains the `pagination` details and the `data`.\n\n---\n\nThe `LiveNewsResponse.pagination` is of type `Pagination` and has the following\nattributes.\n\n- `Pagination.limit` -\u003e your pagination limit value.\n- `Pagination.offset` -\u003e your pagination offset value.\n- `Pagination.count` -\u003e the results count on the current page.\n- `Pagination.total` -\u003e the total count of results available.\n\n---\n\nThe `LiveNewsResponse.data` is a `list[Article]` and each `Article` has the following\nattributes.\n\n- `Article.author` -\u003e the name of the author of the given news article.\n- `Article.title` -\u003e the title text of the given news article.\n- `Article.description` -\u003e the description text of the given news article.\n- `Article.url` - \u003e the URL leading to the given news article.\n- `Article.image` -\u003e an image URL associated with the given news article.\n- `Article.category` -\u003e the category associated with the given news article.\n- `Article.language` -\u003e the language the given news article is in.\n- `Article.country` -\u003e the country code associated with the given news article.\n- `Article.published_at` -\u003e the exact time stamp the given news article was published.\n- `Article.source` -\u003e the source from which the article was taken\n\n---\n\n## Supported News Categories\n\n- general - Uncategorized News\n- business - Business News\n- entertainment - Entertainment News\n- health - Health News\n- science - Science News\n- sports - Sports News\n- technology - Technology News\n\n## Supported Countries\n\nClick [Here](https://mediastack.com/sources) to see the list of all the supported countries.\n\n## Supported Languages\n\n- ar - Arabic\n- de - German\n- en - English\n- es - Spanish\n- fr - French\n- he - Hebrew\n- it - Italian\n- nl - Dutch\n- no - Norwegian\n- pt - Portuguese\n- ru - Russian\n- se - Swedish\n- zh - Chinese\n\n---\n\nMost of the docs are directly taken from the [`mediastacks api docs`](https://mediastack.com/documentation)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadwaith-rajesh%2Fpy-mediastack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadwaith-rajesh%2Fpy-mediastack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadwaith-rajesh%2Fpy-mediastack/lists"}