requests-html: Pythonic HTML Parsing with JavaScript Support
This repository profile is provided by osrepos.com, an open source repository discovery platform.

Summary
requests-html is a Python library designed to simplify HTML parsing and web scraping. It extends the familiar Requests experience with powerful parsing capabilities, including full JavaScript support via Chromium, CSS selectors, and XPath. This makes it an ideal tool for developers needing to interact with dynamic web content.
Repository Information
Topics
Click on any tag to explore related repositories
Use at your own risk
OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of code from these repositories is the user's own responsibility. Always review the repository, source code, dependencies, licenses, and security implications before running or installing anything. OSRepos is not responsible for issues, damages, or losses resulting from third-party repositories.
Introduction
requests-html is a modern, Pythonic library for parsing HTML and scraping websites, created by Kenneth Reitz, the author of the popular Requests library. It aims to make web scraping as intuitive as possible by integrating robust features directly into the Requests workflow. Key capabilities include full JavaScript support, CSS and XPath selectors, and asynchronous operations.
Installation
Installation is straightforward. You can install requests-html using pip:
$ pip install requests-html
If you prefer pipenv, you can use:
$ pipenv install requests-html
Note that requests-html requires Python 3.6 and above.
Examples
Basic GET Request and Link Extraction
from requests_html import HTMLSession
session = HTMLSession()
r = session.get('https://python.org/')
print("All links:", r.html.links)
print("Absolute links:", r.html.absolute_links)
Using CSS Selectors
from requests_html import HTMLSession
session = HTMLSession()
r = session.get('https://python.org/')
about_element = r.html.find('#about', first=True)
if about_element:
print("Element text:", about_element.text)
print("Element HTML:", about_element.html)
print("Element attributes:", about_element.attrs)
Handling JavaScript Rendered Content
requests-html can render JavaScript content using Chromium. The first time render() is called, it will download Chromium.
from requests_html import HTMLSession
session = HTMLSession()
r = session.get('https://pythonclock.org')
# Content before rendering JavaScript
print("Before render:", r.html.search('Python 2.7 will retire in...{}Enable Guido Mode')[0])
# Render JavaScript
r.html.render()
# Content after rendering JavaScript
print("After render:", r.html.search('Python 2.7 will retire in...{}Enable Guido Mode')[0])
# Extract specific data after rendering
periods = [element.text for element in r.html.find('.countdown-period')]
amounts = [element.text for element in r.html.find('.countdown-amount')]
countdown_data = dict(zip(periods, amounts))
print("Countdown data:", countdown_data)
Asynchronous Requests
For concurrent scraping, requests-html supports asynchronous operations.
from requests_html import AsyncHTMLSession
asession = AsyncHTMLSession()
async def get_pythonorg():
r = await asession.get('https://python.org/')
return r
async def get_reddit():
r = await asession.get('https://reddit.com/')
return r
results = asession.run(get_pythonorg, get_reddit)
for result in results:
print(result.html.url)
Why Use It
requests-html stands out by offering a comprehensive solution for web scraping. Its seamless integration with the Requests library makes it immediately familiar to Python developers. The built-in JavaScript rendering capability, powered by Chromium, is a significant advantage for modern, dynamic websites. Furthermore, the support for both CSS selectors (jQuery-style) and XPath provides flexibility in element selection, making it a powerful and versatile tool for extracting data from the web.
Links
- GitHub Repository: https://github.com/psf/requests-html
Related repositories
Similar repositories that may be relevant next.

oh-my-hermes: Enhance Hermes Agent with Advanced AI Workflow and Memory
September 17, 2026
oh-my-hermes is an all-in-one plugin designed to significantly enhance the Hermes Agent. It provides advanced coding intelligence, a robust long-term memory system, and optimized workflow packages, transforming standard Hermes requests into structured, actionable tasks with clear operational layers.
ASC: A Super Fast Android Decompiler for Mobile Reverse Engineering
September 17, 2026
ASC is an innovative and exceptionally fast Android decompiler front-end, specifically designed for mobile researchers and agents. It redefines traditional decompilation by directly querying compiled artifacts, offering on-demand code extraction and analysis without heavy preprocessing. This approach results in significantly reduced memory usage and lightning-fast performance, even on large APKs.

Open Index: A Deterministic Memory Layer for Your AI Agents
September 16, 2026
Open Index is a powerful tool for building domain-specific, accurate, and structured data that AI agents can effectively operate on. It enables the creation of a "brain," a searchable and continuously improving context graph tailored to any domain. This system ensures agents have access to reliable, up-to-date information, enhancing their capabilities and decision-making processes.
tooltrim: Drastically Reduce LLM Agent Tool Output Tokens, Improve Accuracy
September 16, 2026
tooltrim provides drop-in compression for LLM agent tool outputs, drastically cutting tokens while often improving answer accuracy. This provider-agnostic solution offers content-aware compression, faithfulness benchmarks, and seamless integration with popular frameworks or as an OpenAI-compatible proxy.
Source repository
Open the original repository on GitHub.
11 counted GitHub visits