DEV Community

GuGuData
GuGuData

Posted on

Convert Webpage to Markdown: URL to Markdown API Guide | GuGuData

Convert Webpage to Markdown: URL to Markdown API Guide | GuGuData

Fast · Reliable · Clean Formatting · Cloudflare Powered


Overview

The URL to Markdown API by GuGuData provides a powerful solution to convert any publicly accessible webpage into clean, well-formatted Markdown content. This API eliminates the need for manual copy-pasting or complex scraping scripts, enabling seamless content extraction for documentation, content migration, and text analysis workflows.

Key Features

  • 🌐 Universal Web Support: Converts content from any publicly accessible webpage.
  • 📝 Clean Markdown Output: Produces properly formatted Markdown with preserved structure.
  • 🔗 Preserves Content: Maintains links, images, and text formatting from the original webpage.
  • Automatic Validation: Built-in URL validation and comprehensive error handling.
  • Cloudflare Technology: Powered by advanced browser rendering technology for accurate conversion.
  • 📚 Documentation Ready: Perfect for content migration, documentation, and text analysis.
  • 🔒 Full HTTPS & Apple ATS Compatible.
  • 🌐 Multi-node CDN with Load Balancing for ultra-fast response times.

API Endpoint

POST https://api.gugudata.io/v1/websitetools/url2markdown?appkey={{appkey}}
Enter fullscreen mode Exit fullscreen mode

Demo URL

https://api.gugudata.io/v1/websitetools/url2markdown/demo


Request Parameters

Parameter Type Required Default Description
appkey string Yes YOUR_APPKEY Your unique AppKey from GuGuData (required for authentication).
url string Yes N/A The URL of the webpage to convert to Markdown format.

Note: The URL must be publicly accessible and use HTTP or HTTPS protocol.


Response Example

{
  "dataStatus": {
    "statusCode": 200,
    "status": "SUCCESS",
    "statusDescription": "successfully",
    "responseDateTime": "2024-01-15T10:30:00Z",
    "dataTotalCount": 1
  },
  "data": {
    "result": "# Article Title\n\nThis is the converted markdown content from the webpage...\n\n## Section Header\n\nParagraph content with [links](https://example.com) and **bold text**.\n\n![Image](https://example.com/image.jpg)"
  }
}
Enter fullscreen mode Exit fullscreen mode
  • The response contains clean Markdown content in the data.result field.
  • All text formatting, links, and images are preserved in standard Markdown syntax.

Error Codes & Troubleshooting

Error Code Message Description
200 Normal return Markdown content successfully generated and returned.
400 Parameter error Invalid or missing required parameters (URL cannot be empty or invalid).
429 Request frequency limited Exceeded 100 requests per second.
403 Account in arrears Payment required to continue using the service.
402 APPKEY error Invalid or missing APPKEY.
500 API response error Internal server error during Markdown conversion.
503 Service unavailable External service temporarily unavailable.

👉 Tip: Ensure the URL is publicly accessible and properly formatted to avoid conversion errors.


Sample Request (Python)

import requests

url = "https://api.gugudata.io/v1/websitetools/url2markdown?appkey=YOUR_APPKEY"
data = {
    'url': 'https://example.com/article'
}

response = requests.post(url, data=data)
result = response.json()

if result['dataStatus']['statusCode'] == 200:
    markdown_content = result['data']['result']
    print(markdown_content)
else:
    print(f"Error: {result['dataStatus']['statusDescription']}")
Enter fullscreen mode Exit fullscreen mode

Sample Request (JavaScript)

const response = await fetch("https://api.gugudata.io/v1/websitetools/url2markdown?appkey=YOUR_APPKEY", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    url: "https://example.com/article",
  }),
});

const result = await response.json();
if (result.dataStatus.statusCode === 200) {
  console.log(result.data.result);
}
Enter fullscreen mode Exit fullscreen mode

Common Use Cases

  • 📚 Documentation Creation: Convert web articles and tutorials into Markdown for documentation systems.
  • 🔄 Content Migration: Transfer content from websites to Markdown-based platforms like GitHub, GitLab, or static site generators.
  • 📊 Content Analysis: Extract clean text from webpages for analysis, research, or data processing.
  • 📝 Note-Taking: Convert interesting articles into Markdown format for personal knowledge management.
  • 🤖 Automation: Integrate into workflows for automatic content archiving and processing.

FAQ

What types of content can be converted?

The API can convert any publicly accessible webpage including articles, blog posts, documentation, and other text-based content. JavaScript-rendered content is also supported.

Are images preserved in the conversion?

Yes, images are preserved as Markdown image syntax with their original URLs maintained.

Is there a limit on webpage size?

Yes, please refer to GuGuData Documentation for current size limits and processing constraints.

Can I convert password-protected or private pages?

No, only publicly accessible webpages can be converted. Private or authentication-required pages are not supported.


Related Resources


About GuGuData

GuGuData provides reliable, developer-friendly APIs for data processing, recognition, and analysis — helping businesses automate tasks and build smarter applications.


Top comments (0)