从命令行运行爬虫会产生错误

时间:2016-02-05 16:04:46

标签: import.io

当我尝试从cmd运行爬虫时,它会出现此错误

Error: com.fasterxml.jackson.core.JsonParseException: 
Unexpected end-of-input in field name at 
[Source: java.io.FileInputStream@19f6368; line: 2, column: 2]

和使用

的代码
import.ioc.exe -crawl C:\Users\~\Desktop\importCMD\crawler.json C:\Users\~\Desktop\importCMD\auth.json

我尝试过运行,因为管理员仍然无法使用“Win8 / 64bit”并使用最新版本的import.io

Auth json

{
"userGuid": "88f4ec3c97154c----b833fb4cd9fe0",
"apiKey": "88f4ec3c97154c46829b833----------9badfe87c502e8dc0298d153c4433c577d083afdbfbe8df13d66ec762c5a102edcd849a36b1879b5f0f73787a1f99531c9b66679"

}

crawler json

    {  
   "cookiesEnabled":false,
   "robotsDisabled":false,
   "canonicalDisabled":false,
   "outputFile":"C:\\Users\\~\\Desktop\\import.io CMD\\cmd - test.csv",
   "advancedMode":true,
   "connections":3,
   "connectorGuid":"dfb05194-0000-4bbe-b990-302c65875754",
   "pause":1,
   "crawlTemplate":[  
      "https://www.website.com/"
   ],
   "dataTemplate":[  
      "https://www.website.com/{any}/link"
   ],
   "destination":"CSV",
   "maxDepth":0,
   "startUrls":[  
      "https://www.website.com/products/link1",
      "https://www.website.com/products/link2",
      "https://www.website.com/products/link3",
      "https://www.website.com/products/link4",
      "https://www.website.com/products/link5",
      "https://www.website.com/products/link6"
   ],
   "local":false
}    

2 个答案:

答案 0 :(得分:2)

JsonParseException很可能是由于您在crawler.jsonauth.json

中提供的json文件出错了

尝试将这些文件的内容粘贴到this website并按下页面右上角的复选框,如果json有错误。它会告诉你它们在哪里。

答案 1 :(得分:1)

我遇到了同样的问题。我的平台是Windows 7。

如果从import.io知识库(http://support.import.io/knowledgebase/articles/325728-command-line-crawling)复制auth.json,则在第二行的头部有一个U + FEFF字符。

将其删除,您可以在Windows中运行抓取工具。