@ai-lion/lion-free-proxy

1.0.4 • Public • Published

免费的代理爬虫插件

import freeProxy from "@ai-lion/lion-free-proxy";
freeProxy 结构
   fetch,//用代理get http数据, 等于node-fetch, 
   createServer({// 创建本地http服务
       port: 端口
   }),  
   //获取代理服务列表,需要60秒左右时间才会爬取完, 之前返回本地代理
   async getList(): Promise<
      {
         host: string;
         port: string;
         type: string;
         level: number;
         region?: string;
      }[]
   >,
   /**
    * 获取随机代理 需要60秒左右时间才会爬取完, 之前返回本地代理
    * @returns
    */
   async getRandom(): Promise<{
      host: string;
      port: string;
      type: string;
      level: number;
      region?: string;
   }>,
}

##fetch 使用

    const freeProxy = require("@ai-lion/lion-free-proxy");

    freeProxy.createServer(4444);//可以不使用, 创建http服务, 端口4444

    freeProxy.getRandom().then(v=>console.info(v));
    freeProxy.getList().then(v=>console.info(v));

    let res: any = await freeProxy.fetch(url, {
        proxy: {
            host: proxy.host,
            port: port,
            type: proxy.type,//协议,http,https
        },
    });

Readme

Keywords

none

Package Sidebar

Install

npm i @ai-lion/lion-free-proxy

Weekly Downloads

2

Version

1.0.4

License

MIT

Unpacked Size

1.72 MB

Total Files

10

Last publish

Collaborators

  • ai-lion