Instaparser API Skill
Use this skill when the user wants to interact with the Instaparser API to parse articles, PDFs, or generate summaries.
Requirements
- - Network access: This skill makes HTTPS requests to
https://www.instaparser.com/api/. The user must grant network access when prompted. - API key: All requests require an Instaparser API key set as the
INSTAPARSER_API_KEY environment variable.
Getting an API key
- 1. Go to https://www.instaparser.com and create an account.
- After signing in, navigate to the API section of your dashboard to generate an API key.
- Set the key in your environment:
export INSTAPARSER_API_KEY="your_api_key_here"
- 4. The free Trial plan includes a limited number of monthly credits. Paid plans are available for higher usage.
Authentication
All API requests require a Bearer token. The API key should be provided via the INSTAPARSER_API_KEY environment variable, or the user can provide it directly.
CODEBLOCK1
API Endpoints
Article API
POST INLINECODE3
Parse an article from a URL and extract its title, author, body content, images, and more. Uses 1 credit per call.
Request body (JSON):
| Parameter | Type | Required | Description |
|---|
| INLINECODE4 | string | Yes | URL of the article to parse |
| INLINECODE5 |
string | No | Raw HTML content to parse instead of fetching from
url |
|
output | string | No |
"html" (default) or
"text" |
|
use_cache | bool | No | Whether to use cache. Defaults to
true |
Example:
CODEBLOCK2
Response fields:
| Field | Description |
|---|
| INLINECODE12 | Canonical URL |
| INLINECODE13 |
Article title |
|
site_name | Website name |
|
author | Author name |
|
date | Published date (UNIX timestamp) |
|
description | Article description |
|
thumbnail | Thumbnail image URL |
|
html | HTML body (when output is
"html") |
|
text | Plain text body (when output is
"text") |
|
words | Word count |
|
is_rtl |
true if Arabic or Hebrew |
|
images | Array of image URLs |
|
videos | Array of video URLs |
PDF API
Parse PDFs from a URL (GET) or by uploading a file (POST). Uses 5 credits per page.
Parse from URL
GET https://www.instaparser.com/api/1/pdf
| Parameter | Type | Required | Description |
|---|
| INLINECODE29 | string | Yes | URL of the PDF to parse |
| INLINECODE30 |
string | No |
"html" (default) or
"text" |
|
use_cache | bool | No | Whether to use cache. Defaults to
true |
CODEBLOCK3
Upload a file
POST INLINECODE35
Send as multipart form-data with a file field.
CODEBLOCK4
Response fields: Same as Article API.
Summary API
POST INLINECODE37
Generate an AI-powered summary with key sentences. Uses 10 credits per call.
Request body (JSON):
| Parameter | Type | Required | Description |
|---|
| INLINECODE38 | string | Yes | URL of the article to summarize |
| INLINECODE39 |
string | No | HTML content to parse instead of fetching from URL |
|
use_cache | bool | No | Whether to use cache. Defaults to
true |
|
stream | bool | No | Stream the response. Defaults to
false |
CODEBLOCK5
Response fields:
| Field | Description |
|---|
| INLINECODE44 | Array of key sentences extracted from the article |
| INLINECODE45 |
Concise summary of the article |
Status Codes
Parameter missing or malformed |
| 401 | API key is invalid |
| 403 | Account suspended (payment error) |
| 409 | Exceeded monthly credits (Trial plan only) |
| 412 | Upstream parsing error |
| 429 | Rate limit exceeded |
SDK Usage
Python:
CODEBLOCK6
JavaScript:
CODEBLOCK7
Instructions
When the user asks to parse an article, PDF, or generate a summary:
- 1. Check if
INSTAPARSER_API_KEY is set in the environment. If not, ask the user for their API key. - Use
curl via the Bash tool to make the API request. - For article parsing, default to
output: "text" unless the user specifically wants HTML. - For PDF parsing from a local file, use the multipart form-data POST method.
- For PDF parsing from a URL, use the GET method with query parameters.
- Present the results clearly — show title, author, word count, and the extracted content.
- For summaries, display both the overview/summary and the key sentences.
Instaparser API 技能
当用户想要与 Instaparser API 交互以解析文章、PDF 或生成摘要时,使用此技能。
要求
- - 网络访问: 此技能向 https://www.instaparser.com/api/ 发起 HTTPS 请求。用户必须在提示时授予网络访问权限。
- API 密钥: 所有请求都需要将 Instaparser API 密钥设置为 INSTAPARSERAPIKEY 环境变量。
获取 API 密钥
- 1. 前往 https://www.instaparser.com 并创建一个账户。
- 登录后,导航至仪表盘的 API 部分以生成 API 密钥。
- 在您的环境中设置密钥:
bash
export INSTAPARSER
APIKEY=your
apikey_here
- 4. 免费试用计划包含有限数量的月度积分。付费计划适用于更高使用量。
身份验证
所有 API 请求都需要 Bearer 令牌。API 密钥应通过 INSTAPARSERAPIKEY 环境变量提供,或者用户可以直接提供。
Authorization: Bearer $INSTAPARSERAPIKEY
API 端点
文章 API
POST https://www.instaparser.com/api/1/article
从 URL 解析文章,并提取其标题、作者、正文内容、图片等。每次调用消耗 1 积分。
请求体(JSON):
| 参数 | 类型 | 必填 | 描述 |
|---|
| url | 字符串 | 是 | 要解析的文章 URL |
| content |
字符串 | 否 | 要解析的原始 HTML 内容,而非从 url 获取 |
| output | 字符串 | 否 | html(默认)或 text |
| use_cache | 布尔值 | 否 | 是否使用缓存。默认为 true |
示例:
bash
curl -X POST https://www.instaparser.com/api/1/article \
-H Authorization: Bearer $INSTAPARSERAPIKEY \
-H Content-Type: application/json \
-d {url: https://example.com/article, output: text}
响应字段:
文章标题 |
| site_name | 网站名称 |
| author | 作者姓名 |
| date | 发布日期(UNIX 时间戳) |
| description | 文章描述 |
| thumbnail | 缩略图 URL |
| html | HTML 正文(当输出为 html 时) |
| text | 纯文本正文(当输出为 text 时) |
| words | 字数统计 |
| is_rtl | 如果是阿拉伯语或希伯来语则为 true |
| images | 图片 URL 数组 |
| videos | 视频 URL 数组 |
PDF API
从 URL 解析 PDF(GET)或通过上传文件解析 PDF(POST)。每页消耗 5 积分。
从 URL 解析
GET https://www.instaparser.com/api/1/pdf
| 参数 | 类型 | 必填 | 描述 |
|---|
| url | 字符串 | 是 | 要解析的 PDF URL |
| output |
字符串 | 否 | html(默认)或 text |
| use_cache | 布尔值 | 否 | 是否使用缓存。默认为 true |
bash
curl https://www.instaparser.com/api/1/pdf?url=https://example.com/report.pdf&output=text \
-H Authorization: Bearer $INSTAPARSERAPIKEY
上传文件
POST https://www.instaparser.com/api/1/pdf
以 multipart form-data 形式发送,包含 file 字段。
bash
curl -X POST https://www.instaparser.com/api/1/pdf \
-H Authorization: Bearer $INSTAPARSERAPIKEY \
-F file=@report.pdf \
-F output=text
响应字段: 与文章 API 相同。
摘要 API
POST https://www.instaparser.com/api/1/summary
生成由 AI 驱动的摘要,包含关键句子。每次调用消耗 10 积分。
请求体(JSON):
| 参数 | 类型 | 必填 | 描述 |
|---|
| url | 字符串 | 是 | 要摘要的文章 URL |
| content |
字符串 | 否 | 要解析的 HTML 内容,而非从 URL 获取 |
| use_cache | 布尔值 | 否 | 是否使用缓存。默认为 true |
| stream | 布尔值 | 否 | 流式传输响应。默认为 false |
bash
curl -X POST https://www.instaparser.com/api/1/summary \
-H Authorization: Bearer $INSTAPARSERAPIKEY \
-H Content-Type: application/json \
-d {url: https://example.com/article}
响应字段:
| 字段 | 描述 |
|---|
| key_sentences | 从文章中提取的关键句子数组 |
| summary |
文章的简洁摘要 |
状态码
参数缺失或格式错误 |
| 401 | API 密钥无效 |
| 403 | 账户被暂停(支付错误) |
| 409 | 超出月度积分(仅限试用计划) |
| 412 | 上游解析错误 |
| 429 | 超出速率限制 |
SDK 使用
Python:
python
from instaparser import InstaparserClient
client = InstaparserClient(apikey=YOURAPI_KEY)
文章
article = client.Article(url=https://example.com/article, output=text)
PDF
pdf = client.PDF(url=https://example.com/report.pdf)
摘要
summary = client.Summary(url=https://example.com/article)
JavaScript:
javascript
import { InstaparserClient } from instaparser-api;
const client = new InstaparserClient({ apiKey: YOURAPIKEY });
// 文章
const article = await client.article({ url: https://example.com/article, output: text });
// PDF
const pdf = await client.pdf({ url: https://example.com/report.pdf });
// 摘要
const summary = await client.summary({ url: https://example.com/article });
使用说明
当用户要求解析文章、PDF 或生成摘要时:
- 1. 检查环境中是否设置了 INSTAPARSERAPIKEY。如果没有,请向用户询问其 API 密钥。
- 通过 Bash 工具使用 curl 发起 API 请求。
- 对于文章解析,默认使用 output: text,除非用户特别要求 HTML。
- 对于从本地文件解析 PDF,使用 multipart form-data POST 方法。
- 对于从 URL 解析 PDF,使用带查询参数的 GET 方法。
- 清晰呈现结果——显示标题、作者、字数统计和提取的内容。
- 对于摘要,同时显示概述/摘要和关键句子。