tinsoftproxy

tinsoftproxy

Usage no npm install needed!

<script type="module">
  import tinsoftproxy from 'https://cdn.skypack.dev/tinsoftproxy';
</script>

README

tinsoftproxy

Nhằm hỗ trợ việc sử dụng proxy một cách nhanh chóng và đơn giản. Chỉ cần gọi 1 hàm duy nhất để có được proxy không phải thao tác request quá nhiều.

Installation

Via npm:

npm i -S tinsoftproxy

Update via npm:

npm update tinsoftproxy

Usage

const TinSoftProxy = require('tinsoftproxy');

(async () => {
  try {
    const proxyService = new TinSoftProxy({
      user_api_key: 'TINSOFT_USER_API_KEY'
    });

    proxyService.Stream.on('log', data => console.log('##LOG:', data));

    const rp = await proxyService.pickup({
      api_key: process.env.TINSOFT_API_KEY || '',
      location_id: 0
    });

    console.log('rp:', rp);
    // {
    //   isChanged: false,
    //   message: 'Wait 119s',
    //   success: true,
    //   proxy: '116.107.60.32:54877',
    //   location: '15',
    //   next_change: 119,
    //   timeout: 1185,
    //   api_key: 'api_key dùng để get proxy'
    // }
    
  } catch (e) {
    console.log(e);
  }
})();

API

TinSoftProxy([options])

.pickup([options])

  • options <Object>

    • api_key <string> (option) Chỉ định api_key cần get proxy, hoặc để trống thì mạc định thư viện sẽ tự động chọn key
    • location_id <Number> Default: 0 ID Location. Danh sách tại đây
  • return <Object>

    • isChanged <boolean> Proxy IP có sự thay đổi, true là có sự thay đổi
    • proxy <string> Thông tin proxy
    • next_change <Number> Thời gian đợi cho đến lần thay IP tiếp theo (giây)
    • timeout <Number> Có thể xem như là tốc độ của proxy (càng thấp càng nhanh)
    • location <Number|string> ID địa chỉ địa lý của IP. Danh sách tại đây
    • Example:
      {
        isChanged: false,
        message: 'Wait 119s',
        success: true,
        proxy: '116.107.60.32:54877',
        location: '15',
        next_change: 119,
        timeout: 1185,
        api_key: 'api_key dùng để get proxy'
      }
      

TinsoftAPI Document

Author

👤 Văn Tài


Made with ❤️ by Văn Tài