{"id":16590470,"url":"https://github.com/federicotdn/wikiquote","last_synced_at":"2025-04-07T10:26:16.455Z","repository":{"id":26932243,"uuid":"30394613","full_name":"federicotdn/wikiquote","owner":"federicotdn","description":"Retrieve quotes from any Wikiquote article","archived":false,"fork":false,"pushed_at":"2024-04-12T04:44:09.000Z","size":202,"stargazers_count":104,"open_issues_count":4,"forks_count":34,"subscribers_count":9,"default_branch":"main","last_synced_at":"2024-04-24T08:29:24.783Z","etag":null,"topics":["day","language","python","quote","quotes","wikiquote"],"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/federicotdn.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.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":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-02-06T04:11:15.000Z","updated_at":"2024-06-18T00:37:46.603Z","dependencies_parsed_at":"2024-06-18T00:37:34.663Z","dependency_job_id":"057dffd6-7dcd-4168-aefe-ccb5dba28e79","html_url":"https://github.com/federicotdn/wikiquote","commit_stats":{"total_commits":139,"total_committers":13,"mean_commits":"10.692307692307692","dds":0.6330935251798562,"last_synced_commit":"3a6b4acab1b72ebb9fbcad3d82c738bafc8009c9"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/federicotdn%2Fwikiquote","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/federicotdn%2Fwikiquote/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/federicotdn%2Fwikiquote/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/federicotdn%2Fwikiquote/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/federicotdn","download_url":"https://codeload.github.com/federicotdn/wikiquote/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247634059,"owners_count":20970454,"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":["day","language","python","quote","quotes","wikiquote"],"created_at":"2024-10-11T23:13:14.329Z","updated_at":"2025-04-07T10:26:16.418Z","avatar_url":"https://github.com/federicotdn.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# wikiquote\n[![CI Status](https://github.com/federicotdn/wikiquote/workflows/CI/badge.svg)](https://github.com/federicotdn/wikiquote/actions)\n![License](https://img.shields.io/pypi/l/wikiquote.svg?style=flat)\n![](https://img.shields.io/badge/python-3-blue.svg)\n[![Version](https://img.shields.io/pypi/v/wikiquote.svg?style=flat)](https://pypi.python.org/pypi/wikiquote)\n![Black](https://img.shields.io/badge/code%20style-black-000000.svg)\n\nThe `wikiquote` package for Python (\u003e=3.8) allows you to search and retrieve quotes from any [Wikiquote](https://www.wikiquote.org/) article, as well as retrieve the quote of the day.\n\n## Installation\nYou can install the `wikiquote` package using, for example, `pip`:\n```bash\n$ pip install --upgrade wikiquote\n```\n\n## Usage\n```python\n\u003e\u003e\u003e import wikiquote\n\n\u003e\u003e\u003e wikiquote.search('The Matrix')\n# ['The Matrix (film)', 'The Matrix Revolutions', 'The Matrix Reloaded', 'The Animatrix']\n\n\u003e\u003e\u003e wikiquote.quotes('The Matrix (film)', max_quotes=2) # max_quotes defaults to 20\n# ['Don't think you are, know you are.', 'Fate, it seems, is not without a sense of irony.']\n\n\u003e\u003e\u003e wikiquote.quote_of_the_day() # returns a (quote, author) tuple\n# 'Always forgive your enemies; nothing annoys them so much.', 'Oscar Wilde'\n\n\u003e\u003e\u003e wikiquote.qotd() # same as quote_of_the_day()\n\n\u003e\u003e\u003e wikiquote.random_titles(max_titles=3) # max_titles defaults to 20\n# ['The Lion King', 'Johannes Kepler', 'Rosa Parks']\n\n\u003e\u003e\u003e wikiquote.supported_languages()\n# ['de', 'en', 'es', 'eu', 'fr', 'he', 'it', 'pl', 'pt']\n\n```\n\nSome article titles will lead to a Disambiguation page (like `Matrix`), which will raise a `DisambiguationPageException` exception. Usually this happens because there are many articles matching the search term. When this happens, try using `search()` first, and then use one of the specific article titles found.\n\nIf the article searched for does not exist, and no similar results exist, `NoSuchPageException` will be raised instead.\n\nWhen requesting the quote of the day, a `MissingQOTDException` exception will be raised if the quote of the day could not be extracted from Wikiquote's main page. This usually happens because the page's layout has been changed.\n\n## Languages\nThe `wikiquote` module currently supports the following languages:\n\n| Language   | ISO 639-1 Code |\n|------------|----------------|\n| Basque     | `eu`           |\n| English    | `en`           |\n| French     | `fr`           |\n| German     | `de`           |\n| Hebrew     | `he`           |\n| Italian    | `it`           |\n| Polish     | `pl`           |\n| Portuguese | `pt`           |\n| Spanish    | `es`           |\n\nUse the `lang` parameter to specify the language (defaults to `en`):\n```python\n\u003e\u003e\u003e import wikiquote\n\n\u003e\u003e\u003e wikiquote.quotes('Dune', lang='en')[0]\n# 'Parting with friends is a sadness. A place is only a place.'\n\n\u003e\u003e\u003e wikiquote.quotes('Victor Hugo', lang='fr')[0]\n# 'Le plus lourd fardeau, c'est d'exister sans vivre.'\n\n\u003e\u003e\u003e wikiquote.quotes('Nueve reinas', lang='es')[0]\n# 'Más ofendido estás... menos sospechoso parecés.'\n\n\u003e\u003e\u003e wikiquote.quote_of_the_day(lang='es')\n# 'He sospechado alguna vez que la única cosa sin misterio es la felicidad, porque se justifica por sí sola.', 'Jorge Luis Borges'\n\n\u003e\u003e\u003e wikiquote.quotes('Hermann Hesse', lang='de')[0]\n# 'Nun, aller höhere Humor fängt damit an, daß man die eigene Person nicht mehr ernst nimmt.'\n\n\u003e\u003e\u003e wikiquote.quote_of_the_day(lang='it')\n# \"Siamo angeli con un'ala sola. Possiamo volare solo restando abbracciati.\", 'Luciano De Crescenzo'\n\n\u003e\u003e\u003e wikiquote.quote_of_the_day(lang='pl')\n# 'Boże pomóż mi być takim człowiekiem, za jakiego uważa mnie mój pies.', 'Janusz Leon Wiśniewski'\n\n\u003e\u003e\u003e wikiquote.quotes('José Saramago', lang='pt')[0]\n# 'Nem a juventude sabe o que pode, nem a velhice pode o que sabe.'\n```\n\nSpecifying an invalid language will result in an `UnsupportedLanguageException` exception.\n\n## Tips\nUse `random.choice()` to select a random quote from an article:\n```python\n\u003e\u003e\u003e import wikiquote, random\n\n\u003e\u003e\u003e random.choice(wikiquote.quotes('Linus Torvalds'))\n# 'WE DO NOT BREAK USERSPACE!'\n```\n\n## Caveats\nIn some cases, `wikiquote` may fail to retrieve quotes from some articles, or the quote of the day (QOTD). This is due to Wikiquote.org's varying internal article layouts: some quotes may be contained in `div` elements, others in `li`, etc. depending on the article and the language.\n\n## Developing\n[Poetry](https://python-poetry.org/) is required to develop `wikiquote`.\n\nFirst, make sure you have installed all necessary dependencies, including development dependencies:\n```bash\n$ poetry install\n```\n\nThen, check that all files are correctly formatted, and that the type hints are also correct:\n```bash\n$ poetry run make lint\n$ poetry run make install-types\n$ poetry run make types\n```\n\nAfter that, check that all tests pass:\n```bash\n$ poetry run make test\n```\nSome tests may be skipped in the QOTD is not available for some languages.\n\nFinally, create a pull request stating your changes.\n\n## Changelog\nSee the [CHANGELOG.md](CHANGELOG.md) file.\n\n## License\nThe `wikiquote` package is licensed under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffedericotdn%2Fwikiquote","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffedericotdn%2Fwikiquote","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffedericotdn%2Fwikiquote/lists"}