Web-Screenshot-Plugin

A Web Screenshot plugin for OpenAgents.

Introduction

This Web Screenshot Plugin utilize Restpack Screenshot API that can capture screenshots of live web pages and deliver the results in JSON Format.

Build

Include the library with Go get:
go get github.com/extism/go-pdk
You can find the reference documentation for this library on pkg.go.dev.

Usage

Run the plugin using this command :
extism call plugin.wasm run --wasi --allow-host="restpack.io" --input="WEB_URL"
Note : "WEB_URL" - The URL of web page, including the protocol that you want to capture.

Usage Example & Screenshot Result

this territory is moderated
@AtlantisPleb I've done some changes to the code :
JSON Response Handling:
  • The JSON response from the API is decoded to extract the "image" URL field.
Error Handling:
  • Added error handling to manage JSON decoding errors and invalid/missing "image" field in the response.
JSON Encoding:
  • The extracted "image" URL is re-encoded into a JSON object to ensure it can be handled efficiently.
Memory Allocation and Offset Management:
  • The JSON-encoded image URL is allocated in memory.
  • The memory offset where the URL is stored is then passed back as the output.
With these changes, the functionality now correctly fetches only the image URL from the API response, handles errors, and manages memory allocation to ensure seamless processing and output.
reply
Awesome! Thank you!
reply
100 sats \ 1 reply \ @svemir 15 May
This will open up some cool possibilities when combined with agents and other plugins.
reply
I agree, thats why i build this plugin in the first place
reply
Amazing! Will review shortly
reply
Thanks! i already DM on X
reply
IT WORKS! Great job, happy to award a bounty for this
I don't see a DM from you, can you try again @openagentsinc
reply
Hey Thanks! Re-sent the DM or this is my twitter https://twitter.com/kemang1_wangi
reply
hi, any updates regarding the review process?
reply
Yep will do later today
reply