Actor in Rust Example avatar

Actor in Rust Example

Under maintenance
Try for free

No credit card required

Go to Store
This Actor is under maintenance.

This Actor may be unreliable while under maintenance. Would you like to try a similar Actor instead?

See alternative Actors
Actor in Rust Example

Actor in Rust Example

lukaskrivka/rust-actor-example
Try for free

No credit card required

Example actor built in Rust programming language. Downloads HTML from any page. Works on Apify platform and locally.

Example Apify actor in Rust

Minimal example for developing Apify actor in Rust programming language. The code is open source.

The example:

  • Reads user provided URL from input
  • Does HTTP request to get HTML from this URL
  • Saves HTML into OUTPUT record in Key Value Store

This actor works both on Apify platform and locally.

Local usage

For local usage, you need to:

  1. Clone the repository
  2. Install Rust
  3. Create local storage with apify init or manually create folder path apify_storage/key_value_stores/default/
  4. Add INPUT.json file input inside this path that looks like this:
1{
2    "url": "https://apify.com"
3}
  1. Build and run the solution with cargo run
  2. You can find OUTPUT.html next to INPUT.json

Current problems

  • Apify currently doesn't allow increasing memory for builds so they sometimes fails by running out of memory
  • Apify caches the Docker images on its servers. Rust is not yet used much there so a lot of runs have slow cold starts.

Where next?

If you want to see more complex scraping project in Rust, check Rust Scraper which is also open source

Developer
Maintained by Community

Actor Metrics

  • 3 monthly users

  • 3 stars

  • Created in Dec 2021

  • Modified 7 months ago

Categories