Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://gitlab.com/pwoolcoc/soup
Like BeautifulSoup, but for rust
https://gitlab.com/pwoolcoc/soup
rust
Last synced: about 2 months ago
JSON representation
Like BeautifulSoup, but for rust
- Host: gitlab.com
- URL: https://gitlab.com/pwoolcoc/soup
- Owner: pwoolcoc
- License: other
- Created: 2018-11-02T01:35:31.614Z (about 6 years ago)
- Default Branch: master
- Last Synced: 2024-10-08T12:07:03.543Z (2 months ago)
- Topics: rust
- Stars: 41
- Forks: 4
- Open Issues: 14
-
Metadata Files:
- Readme: README.adoc
- License: LICENSE
Awesome Lists containing this project
- awesome-rust-cn - pwoolcoc/soup - A library similar to Pythons BeautifulSoup, designed to enable quick and easy manipulation and querying of HTML documents. [![Build Status](https://gitlab.com/pwoolcoc/soup/badges/master/pipeline.svg)](https://gitlab.com/pwoolcoc/soup/badges/master/pipeline.svg) (Libraries / Web programming)
- awesome-rust - pwoolcoc/soup - A library similar to Pythons BeautifulSoup, designed to enable quick and easy manipulation and querying of HTML documents. [![Build Status](https://gitlab.com/pwoolcoc/soup/badges/master/pipeline.svg)](https://gitlab.com/pwoolcoc/soup/badges/master/pipeline.svg) (Libraries / Web programming)
- awesome-rust - pwoolcoc/soup
- awesome-rust-cn - pwoolcoc/soup - (库 Libraries / 网络编程 Web programming)
- awesome-rust-zh - pwoolcoc/soup - 一个类似于 pythons beautifulsoup 的库,旨在实现对 HTML 文档的快速、简单的操作和查询。[![Build Status](https://gitlab.com/pwoolcoc/soup/badges/master/pipeline.svg)](https://gitlab.com/pwoolcoc/soup/badges/master/pipeline.svg) (库 / 网页编程)
README
= Soup
Inspired by the python library https://www.crummy.com/software/BeautifulSoup/bs4/doc/[BeautifulSoup], this is a layer on top of https://github.com/servo/html5ever[html5ever]
that adds a different API for querying & manipulating HTMLhttps://docs.rs/soup[Documentation (latest release)]
http://pwoolcoc.gitlab.io/soup/[Documentation (master)]
== Installation
In order to use, add the following to your `Cargo.toml`:
----
[dependencies]
soup = "0.5"
----== Usage
----
// src/main.rs
extern crate reqwest;
extern crate soup;use std::error::Error;
use reqwest;
use soup::prelude::*;fn main() -> Result<(), Box> {
let response = reqwest::get("https://google.com")?;
let soup = Soup::from_reader(response);
let some_text = soup.tag("p")
.attr("class", "hidden")
.find()
.and_then(|p| p.text());
OK(())
}----