{"id":13398583,"url":"https://github.com/MechanicalSoup/MechanicalSoup","last_synced_at":"2025-03-14T02:31:26.015Z","repository":{"id":17407697,"uuid":"20180433","full_name":"MechanicalSoup/MechanicalSoup","owner":"MechanicalSoup","description":"A Python library for automating interaction with websites.","archived":false,"fork":false,"pushed_at":"2024-05-21T09:03:33.000Z","size":686,"stargazers_count":4565,"open_issues_count":39,"forks_count":374,"subscribers_count":108,"default_branch":"main","last_synced_at":"2024-05-21T21:57:04.677Z","etag":null,"topics":["beautifulsoup","mechanicalsoup","pypi","python","python-library","requests","web"],"latest_commit_sha":null,"homepage":"http://mechanicalsoup.readthedocs.io/en/stable/","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/MechanicalSoup.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":"CONTRIBUTING.rst","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":"2014-05-26T09:06:11.000Z","updated_at":"2024-06-18T12:34:08.981Z","dependencies_parsed_at":"2023-02-12T20:33:14.109Z","dependency_job_id":"71fb7a6e-beef-4965-8d1c-4f093d064ead","html_url":"https://github.com/MechanicalSoup/MechanicalSoup","commit_stats":{"total_commits":558,"total_committers":59,"mean_commits":9.457627118644067,"dds":0.7132616487455197,"last_synced_commit":"5dea9531e21e2dfa5dce72f5dd54433981f2fd3d"},"previous_names":["hickford/mechanicalsoup"],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MechanicalSoup%2FMechanicalSoup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MechanicalSoup%2FMechanicalSoup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MechanicalSoup%2FMechanicalSoup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MechanicalSoup%2FMechanicalSoup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MechanicalSoup","download_url":"https://codeload.github.com/MechanicalSoup/MechanicalSoup/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243511660,"owners_count":20302595,"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":["beautifulsoup","mechanicalsoup","pypi","python","python-library","requests","web"],"created_at":"2024-07-30T19:00:28.895Z","updated_at":"2025-03-14T02:31:25.677Z","avatar_url":"https://github.com/MechanicalSoup.png","language":"Python","funding_links":[],"categories":["Python","Web Crawling","🕷️ Web Scraping Frameworks","Web爬行","Web Scraping \u0026 Crawling","Core Libraries","HTML 处理","Web Crawling [🔝](#readme)","Awesome Python","Data Gathering","🕸️ Web Scraping \u0026 Crawling"],"sub_categories":["Python","Web Crawling \u0026 Web Scraping","Ranking/Recommender","Tools"],"readme":".. image:: /assets/mechanical-soup-logo.png\n   :alt: MechanicalSoup. A Python library for automating website interaction.\n\nHome page\n---------\n\nhttps://mechanicalsoup.readthedocs.io/\n\nOverview\n--------\n\nA Python library for automating interaction with websites.\nMechanicalSoup automatically stores and sends cookies, follows\nredirects, and can follow links and submit forms. It doesn't do\nJavaScript.\n\nMechanicalSoup was created by `M Hickford\n\u003chttps://github.com/hickford/\u003e`__, who was a fond user of the\n`Mechanize \u003chttps://github.com/jjlee/mechanize\u003e`__ library.\nUnfortunately, Mechanize was `incompatible with Python 3 until 2019\n\u003chttps://github.com/python-mechanize/mechanize/issues/9\u003e`__ and its development\nstalled for several years. MechanicalSoup provides a similar API, built on Python\ngiants `Requests \u003chttp://docs.python-requests.org/en/latest/\u003e`__ (for\nHTTP sessions) and `BeautifulSoup\n\u003chttps://www.crummy.com/software/BeautifulSoup/\u003e`__ (for document\nnavigation). Since 2017 it is a project actively maintained by a small\nteam including `@hemberger \u003chttps://github.com/hemberger\u003e`__ and `@moy\n\u003chttps://github.com/moy/\u003e`__.\n\n|Gitter Chat|\n\nInstallation\n------------\n\n|Latest Version| |Supported Versions|\n\nPyPy3 is also supported (and tested against).\n\nDownload and install the latest released version from `PyPI \u003chttps://pypi.python.org/pypi/MechanicalSoup/\u003e`__::\n\n  pip install MechanicalSoup\n\nDownload and install the development version from `GitHub \u003chttps://github.com/MechanicalSoup/MechanicalSoup\u003e`__::\n\n  pip install git+https://github.com/MechanicalSoup/MechanicalSoup\n\nInstalling from source (installs the version in the current working directory)::\n\n  python setup.py install\n\n(In all cases, add ``--user`` to the ``install`` command to\ninstall in the current user's home directory.)\n\nDocumentation\n-------------\n\nThe full documentation is available on\nhttps://mechanicalsoup.readthedocs.io/. You may want to jump directly to\nthe `automatically generated API\ndocumentation \u003chttps://mechanicalsoup.readthedocs.io/en/stable/mechanicalsoup.html\u003e`__.\n\nExample\n-------\n\nFrom `\u003cexamples/expl_qwant.py\u003e`__, code to get the results from\na Qwant search:\n\n.. code:: python\n\n    \"\"\"Example usage of MechanicalSoup to get the results from the Qwant\n    search engine.\n    \"\"\"\n\n    import re\n    import mechanicalsoup\n    import html\n    import urllib.parse\n\n    # Connect to Qwant\n    browser = mechanicalsoup.StatefulBrowser(user_agent='MechanicalSoup')\n    browser.open(\"https://lite.qwant.com/\")\n\n    # Fill-in the search form\n    browser.select_form('#search-form')\n    browser[\"q\"] = \"MechanicalSoup\"\n    browser.submit_selected()\n\n    # Display the results\n    for link in browser.page.select('.result a'):\n        # Qwant shows redirection links, not the actual URL, so extract\n        # the actual URL from the redirect link:\n        href = link.attrs['href']\n        m = re.match(r\"^/redirect/[^/]*/(.*)$\", href)\n        if m:\n            href = urllib.parse.unquote(m.group(1))\n        print(link.text, '-\u003e', href)\n\nMore examples are available in `\u003cexamples/\u003e`__.\n\nFor an example with a more complex form (checkboxes, radio buttons and\ntextareas), read `\u003ctests/test_browser.py\u003e`__\nand `\u003ctests/test_form.py\u003e`__.\n\nDevelopment\n-----------\n\n|Build Status|\n|Coverage Status|\n|Documentation Status|\n|CII Best Practices|\n\nInstructions for building, testing and contributing to MechanicalSoup:\nsee `\u003cCONTRIBUTING.rst\u003e`__.\n\nCommon problems\n---------------\n\nRead the `FAQ\n\u003chttps://mechanicalsoup.readthedocs.io/en/stable/faq.html\u003e`__.\n\n.. |Latest Version| image:: https://img.shields.io/pypi/v/MechanicalSoup.svg\n   :target: https://pypi.python.org/pypi/MechanicalSoup/\n.. |Supported Versions| image:: https://img.shields.io/pypi/pyversions/mechanicalsoup.svg\n   :target: https://pypi.python.org/pypi/MechanicalSoup/\n.. |Build Status| image:: https://github.com/MechanicalSoup/MechanicalSoup/actions/workflows/python-package.yml/badge.svg?branch=main\n   :target: https://github.com/MechanicalSoup/MechanicalSoup/actions/workflows/python-package.yml?query=branch%3Amain\n.. |Coverage Status| image:: https://codecov.io/gh/MechanicalSoup/MechanicalSoup/branch/main/graph/badge.svg\n   :target: https://codecov.io/gh/MechanicalSoup/MechanicalSoup\n.. |Documentation Status| image:: https://readthedocs.org/projects/mechanicalsoup/badge/?version=latest\n   :target: https://mechanicalsoup.readthedocs.io/en/latest/?badge=latest\n.. |CII Best Practices| image:: https://bestpractices.coreinfrastructure.org/projects/1334/badge\n   :target: https://bestpractices.coreinfrastructure.org/projects/1334\n.. |Gitter Chat| image:: https://badges.gitter.im/MechanicalSoup/MechanicalSoup.svg\n   :target: https://gitter.im/MechanicalSoup/Lobby\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMechanicalSoup%2FMechanicalSoup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMechanicalSoup%2FMechanicalSoup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMechanicalSoup%2FMechanicalSoup/lists"}