
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
requests
bs4
(BeautifulSoup)git clone https://github.com/pythonshik/ai-html-parser.git
cd ai-html-parser
pip install -r requirements.txt
AI
in the root directory.gemini_api_key
inside the AI
folder.AIparser
class:
from AIparse import AIparser
element = AIparser("https://www.youtube.com/@PythonShik")
for i in ["number of videos", "number of subscribers"]:
parsed_data = element.parse(i)
print(f"{parsed_data['explain']}: {parsed_data['value']}")
{
"value": "96",
"explain": "Number of subscribers",
"result": "96 subscribers"
}
This project is an AI-powered HTML parser designed to extract specific data from web pages using Google Gemini's text generation API. The parser processes the HTML source code of a webpage, identifies specific elements, and returns the desired information in a structured JSON format.
BASE.py
The core class for interacting with Google Gemini's text generation API.
generate()
method.history_add(role, content)
: Adds messages to the conversation history.generate()
: Sends data to gemini API and retrieves the generated text.export_history(filename)
: Saves conversation history to a file.import_history(filename)
: Loads conversation history from a file.clear_history(filename)
: Clears the conversation history.prompts.py
Defines the instruction format for AI tasks.
Instructions
first_instruction
: Provides a detailed guide for parsing HTML elements and formatting the response.main.py
The main entry point for the application.
AIparser
.Gen
class for AI communication.AIparser.__init__
: Initializes the parser with a URL and target element.AIparser.parse(element)
: Parses the given element and retrieves AI-generated results.This tool is ideal for:
Feel free to contribute to the project by submitting issues or pull requests.
This project is licensed under the MIT License.
FAQs
AI HTML Parser
We found that ai-html-parse demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.