requests-html: Pythonic HTML Parsing with JavaScript Support

This repository profile is provided by osrepos.com, an open source repository discovery platform.

requests-html: Pythonic HTML Parsing with JavaScript Support

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

Analyzed by OSRepos on July 25, 2026

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

Related repositories

Similar repositories that may be relevant next.

Open Index: A Deterministic Memory Layer for Your AI Agents

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.

AI AgentsKnowledge GraphAgent Memory
tooltrim: Drastically Reduce LLM Agent Tool Output Tokens, Improve Accuracy

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.

PythonLLM AgentsContext Compression
AgentShield: Python Firewall for AI Agent Spend Control

AgentShield: Python Firewall for AI Agent Spend Control

September 16, 2026

AgentShield is a pure Python library designed to prevent runaway AI agents from exceeding budget limits. It offers 10 composable spend rules, evaluated in under 1ms, providing robust cost control. Although its core development has transitioned to sipi.bot, the AgentShield Python package remains available for existing users and its test fixtures are open-source.

PythonAI AgentsCost Control
DA-Forge: Streamlining Declarative Agent Creation for Copilot Notebooks

DA-Forge: Streamlining Declarative Agent Creation for Copilot Notebooks

September 12, 2026

DA-Forge is a Python-based tool by Microsoft designed to automate the creation and deployment of Declarative Agents for Copilot Notebooks. It significantly reduces the manual effort and time required to set up AI assistants with specific grounding references, transforming an 85-minute process into just a few minutes. This tool is essential for developers and researchers working with Copilot Notebooks and Declarative Agents.

PythonMicrosoft 365Copilot

Source repository

Open the original repository on GitHub.

11 counted GitHub visits

View on GitHub
OS
OSRepos

Analysis and discovery of open source repositories. Find interesting projects and follow their updates.

Monitor your website with YourWebsiteScore

OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of third-party repository code is at your own risk. Always review source code, dependencies, licenses, and security implications before running anything.

© 2025 OSRepos. Built with Nuxt 3 and lots of ❤️