Skill: urhd528/gsdata-search (version 1.0.3)

# GS Data Search ## Description A skill that provides a simple interface to search data from projects-databus.gsdata.cn API. ## Installation This skill is automatically available when installed in the Claude Code plugins directory. ## Usage To use this skill, you need to provide the following parameters: - project_id: Your project ID - sign: Your API signature - keywords: Search keywords - posttime_start: Start time for post (format: 2026-03-01 00:00:00) - posttime_end: End time for post (format: 2026-03-01 23:59:59) - limit: Number of results to return (default: 10) ## Example ```python from gsdata_search import search result = search( project_id="your_project_id", sign="your_signature", keywords="your_search_keywords", posttime_start="2026-03-01 00:00:00", posttime_end="2026-03-01 23:59:59", limit=20 ) print(result) ``` ## API Reference ### search(project_id, sign, keywords, posttime_start, posttime_end, limit=10) Searches the GS Data API for data matching the keywords. #### Parameters: - project_id (str): The project ID - sign (str): The API signature - keywords (str): Keywords to search for - posttime_start (str): Start time for post (format: 2026-03-01 00:00:00) - posttime_end (str): End time for post (format: 2026-03-01 23:59:59) - limit (int): Number of results to return (default: 10) #### Returns: - list: The search results as a Python list of dictionaries, each containing only the following fields: - news_title: News title - news_uuid: News UUID - media_name: Media name - news_posttime: Posting time - news_emotion: News emotion (positive/negative/neutral) - news_url: News URL - news_digest: News digest #### Response Structure: ```python [ { "news_title": "News title", "news_uuid": "123456789", "media_name": "Media name", "news_posttime": "2026-03-01 10:30:00", "news_emotion": "positive", "news_url": "https://example.com/news/123", "news_digest": "News digest..." } ] ``` ## Notes - Make sure you have valid project_id and sign credentials - The API has a timeout of 30 seconds - Results are returned as JSON data

path: package.json
content: {
  "name": "gsdata-search",
  "version": "1.0.0",
  "description": "GS Data Search Skill",
  "main": "src/__init__.py",
  "keywords": ["gsdata", "search", "api"],
  "author": "Your Name",
  "license": "MIT",
  "dependencies": {
    "requests": "^2.31.0"
  }
}


path: plugin.json
content: {
  "id": "gsdata-search",
  "version": "1.0.0",
  "name": "GS Data Search",
  "description": "A skill that provides access to the GS Data search API",
  "author": "Your Name",
  "license": "MIT",
  "main": "src/__init__.py",
  "keywords": ["gsdata", "search", "api"],
  "dependencies": {
    "requests": "^2.31.0"
  }
}


path: requirements.txt
content: requests>=2.25.1


path: src/__init__.py
content: """
GS Data Search API Client
访问 projects-databus.gsdata.cn 搜索接口
"""

import json
import requests

API_URL = "http://projects-databus.gsdata.cn:7777/api-project/service"
ROUTER = "/standard/search/get-data"


def search(project_id: str, sign: str, keywords: str, posttime_start: str, posttime_end: str, limit: int = 10) -> dict:
    """
    调用 GS Data 搜索接口

    Args:
        project_id:     项目 ID
        sign:           签名
        keywords:       搜索关键词
        posttime_start: 开始时间 (格式: 2026-03-01 00:00:00)
        posttime_end:   结束时间 (格式: 2026-03-01 23:59:59)
        limit:          返回条数，默认 10

    Returns:
        API 返回的 JSON 数据（dict）
    """
    params_json = json.dumps({"keywords_include": keywords, "limit": limit, "posttime_start": posttime_start, "posttime_end": posttime_end}, ensure_ascii=False)

    payload = {
        "project_id": project_id,
        "sign": sign,
        "router": ROUTER,
        "params": params_json,
    }

    resp = requests.post(API_URL, data=payload, timeout=30)
    resp.raise_for_status()
    api_response = resp.json()

    # 只返回指定字段
    target_fields = ["news_title", "news_uuid", "media_name", "news_posttime", "news_emotion", "news_url", "news_digest"]

    # 处理返回结果为列表格式
    result_list = []
    if "data" in api_response:
        for item in api_response["data"]:
            filtered_item = {}
            for field in target_fields:
                if field in item:
                    filtered_item[field] = item[field]
            result_list.append(filtered_item)

    return result_list


# --------------- 命令行直接运行 ---------------
if __name__ == "__main__":
    import argparse

    parser = argparse.ArgumentParser(description="GS Data 搜索工具")
    parser.add_argument("--project_id", required=True, help="项目 ID")
    parser.add_argument("--sign", required=True, help="签名")
    parser.add_argument("--keywords", required=True, help="搜索关键词")
    parser.add_argument("--posttime_start", required=True, help="开始时间")
    parser.add_argument("--posttime_end", required=True, help="结束时间")
    parser.add_argument("--limit", type=int, default=10, help="返回条数 (默认 10)")
    args = parser.parse_args()

    result = search(args.project_id, args.sign, args.keywords, args.posttime_start, args.posttime_end, args.limit)
    # 按照列表格式输出
    for i, item in enumerate(result, 1):
        print(f"----- 结果 {i} -----")
        for key, value in item.items():
            print(f"{key}: {value}")
        print()


Security scan verdicts — ClawScan: suspicious | static analysis: clean | VirusTotal: clean | SkillSpector: suspicious (HIGH)