{"id":13462120,"url":"https://github.com/gawel/pyquery","last_synced_at":"2025-05-13T15:13:09.165Z","repository":{"id":5698738,"uuid":"6909307","full_name":"gawel/pyquery","owner":"gawel","description":"A jquery-like library for python","archived":false,"fork":false,"pushed_at":"2024-08-30T08:12:28.000Z","size":482,"stargazers_count":2351,"open_issues_count":55,"forks_count":182,"subscribers_count":64,"default_branch":"master","last_synced_at":"2025-04-23T21:44:52.608Z","etag":null,"topics":["css","jquery","lxml","python","python3"],"latest_commit_sha":null,"homepage":"http://pyquery.rtfd.org/","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/gawel.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGES.rst","contributing":null,"funding":null,"license":"LICENSE.txt","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":"2012-11-28T20:27:39.000Z","updated_at":"2025-04-23T20:38:29.000Z","dependencies_parsed_at":"2024-01-03T00:18:07.514Z","dependency_job_id":"17f209d0-19f6-44f6-abb6-34907bd53857","html_url":"https://github.com/gawel/pyquery","commit_stats":{"total_commits":408,"total_committers":53,"mean_commits":7.69811320754717,"dds":"0.37745098039215685","last_synced_commit":"ca860115ee15ad30367b6386ed6abc8f8801600e"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gawel%2Fpyquery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gawel%2Fpyquery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gawel%2Fpyquery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gawel%2Fpyquery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gawel","download_url":"https://codeload.github.com/gawel/pyquery/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253969266,"owners_count":21992264,"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":["css","jquery","lxml","python","python3"],"created_at":"2024-07-31T12:00:39.213Z","updated_at":"2025-05-13T15:13:04.140Z","avatar_url":"https://github.com/gawel.png","language":"Python","readme":"pyquery: a jquery-like library for python\n=========================================\n\n.. image:: https://github.com/gawel/pyquery/actions/workflows/tox.yml/badge.svg\n   :alt: Build Status\n   :target: https://github.com/gawel/pyquery/actions/workflows/tox.yml\n\npyquery allows you to make jquery queries on xml documents.\nThe API is as much as possible similar to jquery. pyquery uses lxml for fast\nxml and html manipulation.\n\nThis is not (or at least not yet) a library to produce or interact with\njavascript code. I just liked the jquery API and I missed it in python so I\ntold myself \"Hey let's make jquery in python\". This is the result.\n\nThe `project`_ is being actively developed on a git repository on Github. I\nhave the policy of giving push access to anyone who wants it and then reviewing\nwhat they do. So if you want to contribute just email me.\n\nPlease report bugs on the `github\n\u003chttps://github.com/gawel/pyquery/issues\u003e`_ issue\ntracker.\n\n.. _deliverance: http://www.gawel.org/weblog/en/2008/12/skinning-with-pyquery-and-deliverance\n.. _project: https://github.com/gawel/pyquery/\n\n..\n   \u003e\u003e\u003e (urlopen, your_url, path_to_html_file) = getfixture('readme_fixt')\n\nQuickstart\n==========\n\nYou can use the PyQuery class to load an xml document from a string, a lxml\ndocument, from a file or from an url::\n\n    \u003e\u003e\u003e from pyquery import PyQuery as pq\n    \u003e\u003e\u003e from lxml import etree\n    \u003e\u003e\u003e import urllib\n    \u003e\u003e\u003e d = pq(\"\u003chtml\u003e\u003c/html\u003e\")\n    \u003e\u003e\u003e d = pq(etree.fromstring(\"\u003chtml\u003e\u003c/html\u003e\"))\n    \u003e\u003e\u003e d = pq(url=your_url)\n    \u003e\u003e\u003e d = pq(url=your_url,\n    ...        opener=lambda url, **kw: urlopen(url).read())\n    \u003e\u003e\u003e d = pq(filename=path_to_html_file)\n\nNow d is like the $ in jquery::\n\n    \u003e\u003e\u003e d(\"#hello\")\n    [\u003cp#hello.hello\u003e]\n    \u003e\u003e\u003e p = d(\"#hello\")\n    \u003e\u003e\u003e print(p.html())\n    Hello world !\n    \u003e\u003e\u003e p.html(\"you know \u003ca href='http://python.org/'\u003ePython\u003c/a\u003e rocks\")\n    [\u003cp#hello.hello\u003e]\n    \u003e\u003e\u003e print(p.html())\n    you know \u003ca href=\"http://python.org/\"\u003ePython\u003c/a\u003e rocks\n    \u003e\u003e\u003e print(p.text())\n    you know Python rocks\n\nYou can use some of the pseudo classes that are available in jQuery but that\nare not standard in css such as :first :last :even :odd :eq :lt :gt :checked\n:selected :file::\n\n    \u003e\u003e\u003e d('p:first')\n    [\u003cp#hello.hello\u003e]\n\n","funding_links":[],"categories":["HTML Manipulation","Uncategorized","Python","资源列表","HTML 处理","HTML操作","HTML Processing","🕸️ Web Scraping \u0026 Crawling","HTML Manipulation [🔝](#readme)","📚 فهرست","Awesome Python"],"sub_categories":["Uncategorized","HTML 处理","Tools","وب اسکرپینگ","HTML Manipulation"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgawel%2Fpyquery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgawel%2Fpyquery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgawel%2Fpyquery/lists"}