<@U04S8PLJWMT> I want to use the connection builde...
# ask-ai
p
@kapa.ai I want to use the connection builder to fetch a html page and pull certain elements off the page. Explan how i can do this using custom components
k
To fetch an HTML page and extract specific elements using Airbyte's Connector Builder, you will need to use Custom Components. This approach is necessary because the built-in components are primarily designed for API-based sources, not for web scraping or HTML parsing. Here’s how you can achieve this: ### 1. Enable Custom Components Custom Components are considered UNSAFE and EXPERIMENTAL and are only available in Self-Managed Community and Enterprise deployments. You must explicitly enable them in your Airbyte deployment by setting the
AIRBYTE_ENABLE_UNSAFE_CODE
environment variable to
true
in your deployment configuration. This can be done via
abctl
or Helm charts. For example, in your `values.yaml`:
Copy code
yaml workload-launcher:     extraEnv:       - name: AIRBYTE_ENABLE_UNSAFE_CODE         value: "true"   connector-builder-server:     extraEnv:       - name: AIRBYTE_ENABLE_UNSAFE_CODE         value: "true"
[How to enable Custom Components](https://docs.airbyte.com/platform/connector-development/connector-builder-ui/custom-components#how-to-enable-custom-components) ### 2. Implement Your Custom Component You need to create a Python class that implements the interface of the component you want to customize. For web scraping, you might implement a custom retriever or record transformation component that fetches the HTML and parses it (e.g., using BeautifulSoup). Example structure for a custom component:
Copy code
python from dataclasses import dataclass, InitVar from typing import Mapping, Any, List, Optional from airbyte_cdk.sources.declarative.requesters.retriever import Retriever  @dataclass class MyHtmlScraper(Retriever):     url: str     parameters: InitVar[Mapping[str, Any]]      def __post_init__(self, parameters: Mapping[str, Any]):         pass      def read_records(self, *args, **kwargs) -> List[Mapping[str, Any]]:         # Fetch HTML, parse with BeautifulSoup, extract elements, return as records         pass
[Custom Components documentation](https://docs.airbyte.com/platform/connector-development/config-based/advanced-topics/custom-components) ### 3. Reference Your Custom Component in the YAML In the Connector Builder UI, switch to the YAML editor and reference your custom component using its fully qualified class name:
Copy code
yaml retriever:   type: "CustomRetriever"   class_name: "my_connector_module.MyHtmlScraper"   url: "https://example.com"
[How to use Custom Components](https://docs.airbyte.com/platform/connector-development/connector-builder-ui/custom-components#how-to-use-custom-components) ### 4. Build and Deploy - Place your Python class in the connector’s module. - Use the YAML editor in the Connector Builder UI to configure your connector. - Deploy and test your connector. ### Notes - You cannot configure custom components through the visual interface; you must use the YAML editor. - Custom Components allow you to implement any logic, including HTML parsing and element extraction, as long as you adhere to the required interface. - Be aware of the security implications, as enabling this feature allows execution of arbitrary code in your Airbyte environment. For more details and examples, see the official documentation on [Custom Components for the Connector Builder](https://docs.airbyte.com/platform/connector-development/connector-builder-ui/custom-components) and [Advanced Topics: Custom Components](https://docs.airbyte.com/platform/connector-development/config-based/advanced-topics/custom-components). If you need to see a full working example or have specific requirements for the HTML elements you want to extract, please provide more details!
p
@kapa.ai error occurs - Only SimpleRetriever and AsyncRetriever are supported
k
A message from kapa.ai
The error "Only SimpleRetriever and AsyncRetriever are supported" indicates that the Connector Builder in Airbyte Cloud does not currently support CustomRetriever (i.e., custom Python code) for retrievers. This limitation is confirmed in the documentation, which states that Custom Components are **not available in Airbyte Cloud**—they are only available in Self-Managed Community and Enterprise deployments, and even then, they must be explicitly enabled due to security concerns. In Cloud, you are limited to the built-in retrievers (SimpleRetriever and AsyncRetriever) and cannot use custom Python for HTML parsing or similar tasks in the Connector Builder UI [Custom components for the Connector Builder](https://docs.airbyte.com/platform/connector-development/connector-builder-ui/custom-components). If you need to fetch HTML and extract elements, you must use a self-managed Airbyte deployment with Custom Components enabled, or develop a fully custom connector outside the Connector Builder UI. This limitation is also reflected in the YAML reference, which shows that CustomRetriever is only available in certain deployment types [CustomRetriever object](https://docs.airbyte.com/platform/connector-development/config-based/understanding-the-yaml-file/reference#/definitions/CustomRetriever). Summary: You cannot use a CustomRetriever (custom Python code) in Airbyte Cloud's Connector Builder. This feature is only available in self-managed deployments with Custom Components enabled. If you are on Cloud, you are restricted to SimpleRetriever and AsyncRetriever, which do not support HTML parsing or custom Python logic.
p
@kapa.ai Please provide RecordSelector.$parameters.name"}
k
A message from kapa.ai
The knowledge sources do not provide a specific example or definition for
RecordSelector.$parameters.name
. However, they do explain how the
$parameters
field works in Airbyte's config-based connector YAML files. The
$parameters
object allows you to pass parameters from a parent component to its subcomponents, which can then be referenced for string interpolation or configuration. For example, you can define a parameter in the
$parameters
object and use it within the component:
Copy code
yaml selector:   $parameters:     name: "example_name"   extractor:     field_path: []
In this example,
name
is set to
"example_name"
and can be referenced within the
RecordSelector
or its subcomponents using the interpolation syntax
{{ parameters['name'] }}
if needed. The documentation does not specify a required or special meaning for a
name
field under `RecordSelector.$parameters`; it is simply a user-defined key-value pair for parameterization purposes [Parameters](https://docs.airbyte.com/platform/connector-development/config-based/advanced-topics/parameters). If you need to use the value elsewhere in your configuration, you can reference it like this:
Copy code
yaml some_field: "{{ parameters['name'] }}"
If you are looking for a specific built-in meaning or required usage for
RecordSelector.$parameters.name
, the knowledge sources do not provide such information. It is a general-purpose parameterization mechanism.