npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

yunlogin-cloud-sdk

v1.1.4

Published

云浏览器sdk

Readme

云浏览器SDK

云浏览器SDK,用于管理云浏览器实例

安装

npm install yunlogin-cloud-sdk

初始化

import cloudSdk from 'yunlogin-cloud-sdk'

const sdk = new cloudSdk("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6InRlc3QiLCJ1c2VySWQiOiJmYW5jaGVu*****");

功能函数

操作详细,请查看下面函数操作实例

| 名称 | 说明 | | :------------ | :----- | | getList | 获取列表 | | create | 创建实例 | | update | 更新实例 |

获取列表

const getList = async () => {
  const list = await sdk.getList();
};

创建实例

const create = async () => {
  const res = await sdk.create({
    sessionName: "实例名称2",
    productId: "test",
    expiredType: 1,
    expired: 0,
    browser: {
      system: "Windows 10",
      uaVersion: "122",
      publicIp: "192.168.0.171",
      ipChannel: "ipdata",
      kernel: "chrome",
      kernelVersion: "122",
    },
  });
};

只有 role 为 owner 才能创建实例

请求参数

| 名称 | 类型 | 是否必须 | 字段含义 | 备注 | | :---------- | :----- | :------- | :------- | :----------------------------------------------------------------- | | orderno | string | 是 | 订单 ID | App 订单标识 | | sessionName | string | 是 | 实例名称 | 实例名称 | | productId | string | 是 | 产品 ID | 产品 ID,决定主机所在的区域 | | expiredType | int | 是 | 到期类型 | 到期类型 1 不过期 2 到期时间 3 剩余时长(单位秒) | | expired | int64 | 是 | 到期时间 | 当 expiredType = 1 时 值为 Unix 时间戳,expiredType = 2 时为时长秒数 | | cookies | array | 否 | cookies | cookies 信息 |

cookies 结构

| 名称 | 类型 | 是否必须 | 字段含义 | 备注 | | :----------------- | :------ | :------- | :------------------------------------- | :----------------------------------------------------------- | | creation_utc | float64 | 是 | Cookie 创建的 UTC 时间戳 | 以浮点数形式表示 | | expires_utc | float64 | 否 | Cookie 过期的 UTC 时间戳 | 以浮点数形式表示,若值为 0 可能表示不过期 | | has_expires | int | 否 | 表示是否有过期时间 | 可以用不同整数值代表不同状态,如 1 表示有过期时间,0 表示无 | | host_key | string | 是 | 关联的主机键 | 用于标识 Cookie 所属的主机 | | is_httponly | int | 否 | 表示是否为 HttpOnly Cookie | 通常用 1 表示是,0 表示否,HttpOnly 的 Cookie 不能通过脚本访问 | | is_persistent | int | 否 | 表示是否为持久化 Cookie | 用不同整数值代表不同状态,如 1 表示持久化,0 表示非持久化 | | is_same_party | int | 否 | 表示是否为 SameParty Cookie | 用于跨站请求相关的安全控制,用不同整数值代表不同状态 | | is_secure | int | 否 | 表示是否为安全 Cookie | 通常用 1 表示是,0 表示否,安全 Cookie 仅在 HTTPS 连接中传输 | | last_access_utc | float64 | 否 | 最后访问的 UTC 时间戳 | 以浮点数形式表示,记录最后一次访问该 Cookie 的时间 | | last_update_utc | float64 | 否 | 最后更新的 UTC 时间戳 | 以浮点数形式表示,记录最后一次更新该 Cookie 的时间 | | name | string | 是 | Cookie 的名称 | 用于标识该 Cookie 的唯一名称 | | path | string | 是 | Cookie 适用的路径 | 表示该 Cookie 在哪些路径下是有效的 | | priority | int | 否 | Cookie 的优先级 | 不同整数值代表不同优先级,如 1 表示低,2 表示中,3 表示高 | | samesite | int | 否 | 表示 SameSite 属性值 | 用于控制跨站请求时 Cookie 的发送,不同整数值代表不同属性值 | | source_port | int | 否 | 源端口号 | 记录创建该 Cookie 的源端口号 | | source_scheme | int | 否 | 源协议方案 | 不同整数值代表不同协议,如 1 表示 HTTP,2 表示 HTTPS | | top_frame_site_key | string | 否 | 顶级框架的站点键 | 用于标识顶级框架的站点信息 | | value | string | 是 | Cookie 的值 | 存储 Cookie 的实际内容 |

browser 结构

| 名称 | 类型 | 是否必须 | 字段含义 | 备注 | | :---------- | :----- | :------- | :------- | :------------------------------------------------------------------- | | system | string | 是 | 操作系统 | 目前支持: Windows 7,Windows 8,Windows 8.1,Windows 10,Windows 11 | | uaVersion | string | 否 | ua 大版本号 | 范围 100-124 | | publicIp | string | 是 | 公网 ip | 设置代理取代理里的 IP | | ipChannel | string | 否 | ip 检测渠道 | 可为空,枚举 ip2location,ipdata | | kernel | string | 是 | 内核类型 | 枚举 chrome,firefox | | kernelVersion | string | 是 | 内核版本 | 107,119,122 | | proxy | object | 否 | 代理信息 | | | site_accounts | array | 否 | 账号信息 | 数组,每个元素为一个账号信息,包含 user,pwd,site |

{
  "sessionName": "实例名称",
  "productId": "产品ID",
  "expiredType": 1,
  "expired": 0,
  "browser": {
    "headless": "1",
    "system": "",
    "uaVersion": "",
    "publicIp": "192.168.0.171",
    "ipChannel": "",
    "kernel": "chrome",
    "kernelVersion": "127",
    "proxy": {
      "protocol": "http",
      "host": "192.168.0.171",
      "port": 10809,
      "userName": "",
      "password": ""
    },
    "site_accounts": [
      {
        "user": "",
        "pwd": "",
        "site": ""
      }
    ]
  }
}

返回值

{
  "reqId": "a0d29fff-1315-44ee-8ad7-7905d6726a4f",
  "code": 200,
  "msg": "OK",
  "data": {
    "id": 6,
    "appID": "",
    "userId": "",
    "companyId": "",
    "sessionId": "7fe752d6369745e4affb4c645e4faba2",
    "sessionName": "local",
    "productId": "hztest",
    "cloudId": "fcd1d3f39cba4a94b95d255c4e5efd64",
    "browserUrl": "",
    "apiKey": "7fe752d6369745e4affb4c645e4faba2",
    "status": 2,
    "healthy": 1,
    "expiredType": 1,
    "expired": 0,
    "totalDuration": 14045,
    "duration": 0,
    "info": null,
    "browser": {
      "system": "Windows 11",
      "publicIp": "127.0.0.1",
      "kernel": "chrome",
      "kernelVersion": "127",
      "proxy": {
        "protocol": "",
        "host": "",
        "port": 0,
        "userName": "",
        "password": ""
      }
    },
    "country": "CN",
    "city": "CN"
  }
}

更新实例指纹

const update = async () => {
  const res = await sdk.update(
    "c78f137783584d18946955cac****",
    "fad77b07f127427da825d3df****",
    {
      flag: 0,
      sessionId: "fad77b07f127427da825d3df****",
      sessionName: "实例名称112233",
      browser: {
        system: "Windows 10",
        uaVersion: "122",
        publicIp: "192.168.0.171",
        ipChannel: "ipdata",
        kernel: "chrome",
        kernelVersion: "122",
      },
    }
  );
};

参数

| 名称 | 类型 | 是否必须 | 字段含义 | 备注 | | :------------ | :----- | :------- | :---------- | :---------------------------------------------------------------------- | | flag | int | 否 | 更新标识 | 0: 更新基础信息 2:更新指纹信息 4:更新代理信息 8:清除 cookie 16:清除缓存 |

cookies 结构

| 名称 | 类型 | 是否必须 | 字段含义 | 备注 | | :----------------- | :------ | :------- | :------------------------------------- | :----------------------------------------------------------- | | creation_utc | float64 | 是 | Cookie 创建的 UTC 时间戳 | 以浮点数形式表示 | | expires_utc | float64 | 否 | Cookie 过期的 UTC 时间戳 | 以浮点数形式表示,若值为 0 可能表示不过期 | | has_expires | int | 否 | 表示是否有过期时间 | 可以用不同整数值代表不同状态,如 1 表示有过期时间,0 表示无 | | host_key | string | 是 | 关联的主机键 | 用于标识 Cookie 所属的主机 | | is_httponly | int | 否 | 表示是否为 HttpOnly Cookie | 通常用 1 表示是,0 表示否,HttpOnly 的 Cookie 不能通过脚本访问 | | is_persistent | int | 否 | 表示是否为持久化 Cookie | 用不同整数值代表不同状态,如 1 表示持久化,0 表示非持久化 | | is_same_party | int | 否 | 表示是否为 SameParty Cookie | 用于跨站请求相关的安全控制,用不同整数值代表不同状态 | | is_secure | int | 否 | 表示是否为安全 Cookie | 通常用 1 表示是,0 表示否,安全 Cookie 仅在 HTTPS 连接中传输 | | last_access_utc | float64 | 否 | 最后访问的 UTC 时间戳 | 以浮点数形式表示,记录最后一次访问该 Cookie 的时间 | | last_update_utc | float64 | 否 | 最后更新的 UTC 时间戳 | 以浮点数形式表示,记录最后一次更新该 Cookie 的时间 | | name | string | 是 | Cookie 的名称 | 用于标识该 Cookie 的唯一名称 | | path | string | 是 | Cookie 适用的路径 | 表示该 Cookie 在哪些路径下是有效的 | | priority | int | 否 | Cookie 的优先级 | 不同整数值代表不同优先级,如 1 表示低,2 表示中,3 表示高 | | samesite | int | 否 | 表示 SameSite 属性值 | 用于控制跨站请求时 Cookie 的发送,不同整数值代表不同属性值 | | source_port | int | 否 | 源端口号 | 记录创建该 Cookie 的源端口号 | | source_scheme | int | 否 | 源协议方案 | 不同整数值代表不同协议,如 1 表示 HTTP,2 表示 HTTPS | | top_frame_site_key | string | 否 | 顶级框架的站点键 | 用于标识顶级框架的站点信息 | | value | string | 是 | Cookie 的值 | 存储 Cookie 的实际内容 |

browser 结构

| 名称 | 类型 | 是否必须 | 字段含义 | 备注 | | :----------------- | :------ | :------- | :------------------------------------- | :----------------------------------------------------------- | | system | string | 是 | 操作系统 | 目前支持: Windows 7,Windows 8,Windows 8.1,Windows 10,Windows 11 | | uaVersion | string | 否 | ua 大版本号 | 范围 100-124 | | publicIp | string | 是 | 公网 ip | 代理 IP,未设置代理,将会取所在主机IP | | ipChannel | string | 否 | ip 检测渠道 | 可为空,枚举 ip2location,ipdata | | kernel | string | 是 | 内核类型 | 枚举 chrome,firefox | | kernelVersion | string | 是 | 内核版本 | 107,119,122 | | proxy | object | 否 | 代理信息 | | | site_accounts | array | 否 | 账号信息 | 数组,每个元素为一个账号信息,包含 user,pwd,site |

  • 请求
{
  "flag": 0,
  "sessionId": "c61458b4d8464453b9f120dfbea736db",
  "sessionName": "实例名称",
  "browser": {
    "system": "",
    "uaVersion": "",
    "publicIp": "192.168.0.171",
    "ipChannel": "",
    "kernel": "chrome",
    "kernelVersion": "127",
    "proxy": {
      "protocol": "http",
      "host": "192.168.0.171",
      "port": 10809,
      "userName": "",
      "password": ""
    }
  }
}

interface

提供接口数据,方便用户快速使用

/** 环境信息 */
export interface EnvData {
    id: number;
    userId: string;
    companyId: string;
    apiKey: string;
    sessionId: string;
    /** 名称 */
    sessionName: string;
    productId: string;
    /**
     * 服务器类型
     *
     * @description 海外:包含“hwtest” 其他国内
     */
    cloudId: string;
    /** 到期类型  到期类型 1:不过期 2:到期时间 3:剩余时长(单位秒)*/
    expiredType: number;
    /** 到期时间 */
    expired: number;
    sessionLogId: number;
    /** rpa连接ws地址 */
    browserUrl: string;
    /**
     * 状态 1:运行 2:关闭 3:删除
     */
    status: number;
    checktime: string;
    errorNum: number;
    duration: number;
    clientNum: number;
    info: null;
    /** 环境信息 */
    browser: any;
    /** 更新日期 */
    updatedAt: string;
    /** 创建日期 */
    createdAt: string;
}
/** 环境列表数据 */
export interface SessionListData {
    /** 环境列表信息 */
    list: envData[];
    /** 总数 */
    total: number;
    /** 每页显示条数 */
    pageSize: number;
    /** 当前页 */
    currentPage: number;
}
export interface SessionListResponse {
    reqId: string;
    /**
     * 状态码 200:成功
     */
    code: number;
    msg: "OK";
    /** 环境信息 */
    data: SessionListData;
}

// 请求接口 ********************************************
/** 账号信息 */
export interface IAccounts {
    /** 账号 */
    user: string;
    /** 密码 */
    pwd: string;
    /** 站点 */
    site: string;
}
/** 代理信息 */
export interface IProxy {
    /** 协议类型 */
    protocol: string;
    /** 地址 */
    host: string;
    /** 端口 */
    port: number;
    /** 账号 */
    userName: string;
    /** 密码 */
    password: string;
}

/** 环境信息 */
export interface IBrowser {
    /**
     * 操作系统
     *
     * @description 目前支持: Windows 7,Windows 8,Windows 8.1,Windows 10,Windows 11
     */
    system: string;
    /**
     * ua 大版本号
     * @description 范围 100-124
     */
    uaVersion?: string;
    /**
     * 公网 ip
     * @description 设置代理取代理里的 IP
     */
    publicIp: string;
    /**
     * ip 检测渠道
     * @description 可为空,枚举 ip2location,ipdata
     */
    ipChannel?: string;
    /**
     * 内核类型 chrome,firefox
     */
    kernel: string;
    /**
     * 内核版本 107,119,122
     */
    kernelVersion: string;
    /** 代理信息 */
    proxy?: IProxy;
    /** 账号信息 */
    site_accounts?: IAccounts[];
}

/** 环境创建入参 */
export interface ICreateReqParams {
    /** 实例名称 */
    sessionName: string;
    /** 产品 ID,决定主机所在的区域 */
    productId: string;
    /** 到期类型  1:不过期 2:到期时间 3:剩余时长(单位秒)*/
    expiredType: number;
    /**
     * 到期时间
     * @description 当 expiredType = 1 时 值为 Unix 时间戳,expiredType = 2 时为时长秒数
     */
    expired: number;
    /** 环境指纹信息 */
    browser: IBrowser;
}

/** 环境更新信息入参 */
export interface IUpdateReqParams {
    /**
     * 更新标识 0:更新基础信息 2:更新指纹信息 4:更新代理信息 8:清除 cookie 16:清除缓存
     */
    flag?: number;
    sessionId: string;
    sessionName: string;
    browser: IBrowser;
}