kaptcha.js 728 B

123456789101112131415161718192021222324252627
  1. const axios = require('axios');
  2. const apiUrl = 'https://api.kuaishibie.cn/predict';
  3. const getKaptcha = async (base64data) => {
  4. try {
  5. const response = await axios.post(apiUrl, {
  6. username: 'Pchen0', // 用户名
  7. password: 'Yx3ud937', // 密码
  8. typeid: '3',
  9. image: base64data
  10. });
  11. const data = response.data;
  12. if (data.success) {
  13. const { result } = data.data;
  14. return result;
  15. } else {
  16. console.error(data.message);
  17. throw new Error(data.message);
  18. }
  19. } catch (error) {
  20. console.error('请求失败:', error.message);
  21. throw error;
  22. }
  23. };
  24. module.exports = getKaptcha;