Poplcip插件需求(ip归属地查询)

以下是我找gpt编写的,也运行不起来

#popclip 
name: ip
icon: Hi!
javascript: |
  // 获取选定文本
  const text = popclip.input.text;
  
  // 构造curl命令的URL
  const url = `https://ip.ping0.cc/geo/${text}`;

  // 发送GET请求
  fetch(url)
    .then(response => response.text())
    .then(data => {
      // 将响应显示在PopClip中
      popclip.showText(data);
    })
    .catch(error => {
      // 处理错误
      console.error(error);
      popclip.showText(`Error: ${error.message}`);
    });