Fetches a URL and converts its HTML content to clean Markdown format with optional metadata extraction
Markdown
package main
import (
"context"
"fmt"
"github.com/stainless-sdks/tabstack-go"
"github.com/stainless-sdks/tabstack-go/option"
)
func main() {
client := tabstack.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.Extract.Markdown(context.TODO(), tabstack.ExtractMarkdownParams{
URL: "https://example.com/blog/article",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Content)
}
{
"content": "# Example Article Title\n\nThis is the article content converted to markdown...",
"metadata": {
"author": "Example Author",
"description": "This is an example article description",
"image": "https://example.com/images/article.jpg",
"publisher": "Example Publisher",
"site_name": "Example Blog",
"title": "Example Article Title",
"type": "article",
"url": "https://example.com/blog/article"
},
"url": "https://example.com/blog/article"
}{
"content": "---\ntitle: Example Article Title\ndescription: This is an example article description\nauthor: Example Author\npublisher: Example Publisher\nimage: https://example.com/images/article.jpg\nsite_name: Example Blog\nurl: https://example.com/blog/article\ntype: article\n---\n\n# Example Article Title\n\nThis is the article content converted to markdown...",
"url": "https://example.com/blog/article"
}{
"error": "access to internal resources is not allowed"
}{
"error": "url is invalid"
}{
"error": "failed to convert HTML to Markdown"
}{
"error": "failed to fetch URL"
}Returns Examples
{
"content": "# Example Article Title\n\nThis is the article content converted to markdown...",
"metadata": {
"author": "Example Author",
"description": "This is an example article description",
"image": "https://example.com/images/article.jpg",
"publisher": "Example Publisher",
"site_name": "Example Blog",
"title": "Example Article Title",
"type": "article",
"url": "https://example.com/blog/article"
},
"url": "https://example.com/blog/article"
}{
"content": "---\ntitle: Example Article Title\ndescription: This is an example article description\nauthor: Example Author\npublisher: Example Publisher\nimage: https://example.com/images/article.jpg\nsite_name: Example Blog\nurl: https://example.com/blog/article\ntype: article\n---\n\n# Example Article Title\n\nThis is the article content converted to markdown...",
"url": "https://example.com/blog/article"
}{
"error": "access to internal resources is not allowed"
}{
"error": "url is invalid"
}{
"error": "failed to convert HTML to Markdown"
}{
"error": "failed to fetch URL"
}