Better HN
topnewbestaskshowjobs
Log inSign up

matsche

191 karma · joined Mar 9, 2018 (8y ago) · 16 submissions

Submissions

1.

Show HN: Cargo-memex – compile rust code into a meme and run it(github.com ↗)

61 points · by matsche · 5y ago · 5 comments

comment 5y ago · link · parent

paperoni is awesome!

I once implemented the crossref api in rust in order to search for publications from the command line https://github.com/mattsse/crossref-rs

comment 5y ago · link · parent

Yes, you can either limit how many request can be send concurrently or enforce a fixed or random delay in between consecutive requests.

Basically this a just a futures_timer::Delay [0] that is reset after each request, which is non blocking.

[0] https://docs.rs/futures-timer/3.0.2/futures_timer/

comment 5y ago · link · parent

Thanks, you're right. I fixed it just now by also requiring the tokio feature for all the tests in the Cargo.toml.

comment 5y ago · link · parent

The guys from corridor crew did a great break down of that amazing scene [0]

[0] https://youtu.be/pTl42COCNaM?t=255

comment 5y ago · link · parent

I haven't used scraper too much. I personally find the predicate approach of select.rs [0] easier to use. However in this case the selector approach just made more sense. Standalone html5ever can be a bit cumbersome to work with directly, scraper is basically an implementation of the html5ever's `TreeSink` trait, where as `select.rs` uses the hmtl5ever `RcDom` to parse the document but stores it in a more convenient way. If you look for a minimal approach you should at select.rs which basicially only depends on html5ever

[0] https://github.com/utkarshkukreti/select.rs

7.

Show HN: Voyager – write a web crawler/scraper as a state machine in Rust(github.com ↗)

110 points · by matsche · 5y ago · 11 comments

comment 5y ago · link · parent

tokio support just landed https://github.com/mattsse/chromiumoxide

comment 5y ago · link · parent

Unfortunately this crate has been abandoned by its author for quite some time now. The main differences are that are that chromiumoxide uses async rust by design and that all the devtools protocol types are generated.

rust-headless-chrome was very helpful for some parts and bootstrapped some parts of chromiumoxide, such as the key and mouse clicking. However I looked at chromedp and puppeteer itself for the most part.

comment 5y ago · link · parent

> The pdl files are the canonical protocol definitions and are maintained manually by the devtools team [0].

The JSON protocol definition files are then in fact being generated from those pdl files. You find them mirrored in the devtools-protocol-repo [1]

[0] https://chromedevtools.github.io/devtools-protocol/ [1] https://github.com/ChromeDevTools/devtools-protocol/

comment 5y ago · link · parent

I started that way, but that was more work than writing a generator. Luckily I found https://github.com/chromedp/pdlgen

comment 5y ago · link · parent

It uses async-tungstenite [0] for the websocket part. At the moment configured only with async-std-runtime but since async-tungstenite also supports tokio, the option to use tokio instead of async-std will be added as well.

[0] https://github.com/sdroege/async-tungstenite

comment 5y ago · link · parent

It only supports the chrome devtools protocol[0]. chromiumoxide is therefor more like a (limited) puppeteer rust port. Support for javascript page injection is currently being worked on

[0] https://chromedevtools.github.io/devtools-protocol/

14.

Show HN: Chromiumoxid – An Async Headless Chrome API in Rust(github.com ↗)

127 points · by matsche · 5y ago · 19 comments

15.

Show HN: Extrablatt – customizable news article scraping in Rust and WebAssembly(mattsse.github.io ↗)

4 points · by matsche · 6y ago · discuss

comment 6y ago · link · parent

it baffles me that it had to come this far. There were warning signs all over it.

The German BaFin messed up so badly that one must either fundamentally doubt theircompetence or question their integrity.