Skip to content

[Components] CaptureKit #17530 #17770

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 30, 2025
Merged

[Components] CaptureKit #17530 #17770

merged 4 commits into from
Jul 30, 2025

Conversation

lcaresia
Copy link
Collaborator

@lcaresia lcaresia commented Jul 24, 2025

WHY

Summary by CodeRabbit

  • New Features

    • Added a "Capture Screenshot" action to capture high-quality webpage images with customizable options.
    • Introduced a "Scrape Content" action to extract structured data, metadata, links, and HTML from webpages.
  • Enhancements

    • Integrated new configuration options for webpage capture and scraping, including device emulation, caching, selector targeting, and URL blocking.
  • Chores

    • Updated package version and added a new dependency for improved platform support.

@lcaresia lcaresia self-assigned this Jul 24, 2025
Copy link

vercel bot commented Jul 24, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs-v2 ⬜️ Ignored (Inspect) Visit Preview Jul 29, 2025 0:33am
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) Jul 29, 2025 0:33am

@lcaresia lcaresia linked an issue Jul 24, 2025 that may be closed by this pull request
Copy link
Contributor

coderabbitai bot commented Jul 24, 2025

Walkthrough

This update introduces two new action modules for capturing screenshots and scraping webpage content, along with a supporting app integration that defines property schemas and API methods for these actions. The package metadata is updated to reflect a new version, add a dependency, and correct JSON formatting.

Changes

Cohort / File(s) Change Summary
Capture Screenshot Action
components/capturekit/actions/capture-screenshot/capture-screenshot.mjs
Added new "Capture Screenshot" action module with metadata, properties, and asynchronous run logic that captures a screenshot via the app and saves it to a temporary file.
Scrape Content Action
components/capturekit/actions/scrape-content/scrape-content.mjs
Added new "Scrape Content" action module with metadata, properties, and asynchronous run logic that scrapes structured content from webpages using the app.
CaptureKit App Integration
components/capturekit/capturekit.app.mjs
Added property definitions for webpage capture and scraping, implemented private request method, and public async methods for screenshot capture and content scraping.
Package Metadata
components/capturekit/package.json
Updated package version to 0.1.0, added dependency on @pipedream/platform@^3.1.0, and fixed JSON formatting by adding a missing closing brace.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CaptureScreenshotAction
    participant CaptureKitApp
    participant CaptureKitAPI

    User->>CaptureScreenshotAction: Trigger run()
    CaptureScreenshotAction->>CaptureKitApp: captureScreenshot(params)
    CaptureKitApp->>CaptureKitAPI: POST /capture
    CaptureKitAPI-->>CaptureKitApp: Screenshot data (array buffer)
    CaptureKitApp-->>CaptureScreenshotAction: Screenshot data
    CaptureScreenshotAction->>CaptureScreenshotAction: Save file to temp dir
    CaptureScreenshotAction-->>User: Return file path and summary
Loading
sequenceDiagram
    participant User
    participant ScrapeContentAction
    participant CaptureKitApp
    participant CaptureKitAPI

    User->>ScrapeContentAction: Trigger run()
    ScrapeContentAction->>CaptureKitApp: scrapeContent(params)
    CaptureKitApp->>CaptureKitAPI: POST /content
    CaptureKitAPI-->>CaptureKitApp: Scraped content (structured data)
    CaptureKitApp-->>ScrapeContentAction: Scraped content
    ScrapeContentAction-->>User: Return response and summary
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15 minutes

Poem

A rabbit hops through code anew,
With screenshots crisp and data true.
Scrape and capture, swift and bright,
Webpage wonders, day and night.
Version bumped, dependencies set—
The cleverest kit a bunny's met!
🐇✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ae16bf6 and a26ae51.

📒 Files selected for processing (1)
  • components/capturekit/actions/scrape-content/scrape-content.mjs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • components/capturekit/actions/scrape-content/scrape-content.mjs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: pnpm publish
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch issue-17530

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (2)
components/capturekit/actions/scrape-content/scrape-content.mjs (1)

54-68: Enhance error handling and array parameter processing.

The core logic is sound, but consider these improvements:

  1. Add error handling for the API call
  2. The array parameter handling could be more defensive
  3. Consider a more descriptive summary message
 async run({ $ }) {
+  try {
     const response = await this.app.scrapeContent({
       $,
       params: {
         url: this.url,
         include_html: this.includeHtml,
         use_defuddle: this.useDefuddle,
         selector: this.selector,
-        remove_selectors: (this.removeSelectors || []).join(","),
-        block_urls: (this.blockUrls || []).join(","),
+        remove_selectors: Array.isArray(this.removeSelectors) ? this.removeSelectors.join(",") : "",
+        block_urls: Array.isArray(this.blockUrls) ? this.blockUrls.join(",") : "",
       },
     });
-    $.export("$summary", "Successfully sent the Scrape Content request");
+    $.export("$summary", `Successfully scraped content from ${this.url}`);
     return response;
+  } catch (error) {
+    throw new Error(`Failed to scrape content: ${error.message}`);
+  }
 },
components/capturekit/capturekit.app.mjs (1)

6-98: Comprehensive property definitions with minor typo to fix.

The propDefinitions are well-structured and cover all necessary parameters. However, there's a typo that needs correction.

     blockUrls: {
       type: "string[]",
       label: "Block URLs",
-      description: "A ist of URL patterns to block. You can specify URLs, domains, or simple patterns, e.g.: `.example.com/`",
+      description: "A list of URL patterns to block. You can specify URLs, domains, or simple patterns, e.g.: `.example.com/`",
       optional: true,
     },
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bdd5ea4 and 0f40dfb.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (4)
  • components/capturekit/actions/capture-screenshot/capture-screenshot.mjs (1 hunks)
  • components/capturekit/actions/scrape-content/scrape-content.mjs (1 hunks)
  • components/capturekit/capturekit.app.mjs (1 hunks)
  • components/capturekit/package.json (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Publish TypeScript components
  • GitHub Check: pnpm publish
  • GitHub Check: Lint Code Base
🔇 Additional comments (5)
components/capturekit/package.json (2)

3-3: LGTM! Appropriate version bump for new features.

The version increment from 0.0.1 to 0.1.0 follows semantic versioning conventions for adding new functionality.


14-17: Good addition of required dependency and JSON formatting fix.

The @pipedream/platform dependency is correctly added to support the new app integration, and the missing closing brace for publishConfig has been properly fixed.

components/capturekit/actions/scrape-content/scrape-content.mjs (1)

1-11: LGTM! Well-structured action module with proper imports and metadata.

The action is properly structured with appropriate imports, metadata, and property definitions using the app's propDefinitions.

components/capturekit/actions/capture-screenshot/capture-screenshot.mjs (1)

1-12: LGTM! Proper imports and action structure.

The action is well-structured with appropriate imports and metadata.

components/capturekit/capturekit.app.mjs (1)

100-118: LGTM! Well-implemented base methods with proper authentication.

The _baseUrl() and _makeRequest() methods are properly implemented with correct authentication header handling.

lcaresia and others added 3 commits July 25, 2025 08:18
Copy link
Collaborator

@michelle0927 michelle0927 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Ready for QA!

@vunguyenhung vunguyenhung merged commit cdbceec into master Jul 30, 2025
11 checks passed
@vunguyenhung vunguyenhung deleted the issue-17530 branch July 30, 2025 04:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Components] CaptureKit
3 participants