Browse Source

新增基于页面渲染的下载方法

maxiaoshan 3 năm trước cách đây
mục cha
commit
5fc1eddac5
2 tập tin đã thay đổi với 10 bổ sung0 xóa
  1. 3 0
      src/config.json
  2. 7 0
      src/spider/script.go

+ 3 - 0
src/config.json

@@ -64,6 +64,9 @@
     },
     "fileServer": "http://123.56.236.148:9333",
     "jsvmurl": "http://127.0.0.1:8080/jsvm",
+    "renderaddr": "http://8.131.72.226:8998/render.json",
+    "proxyaddr": "http://cc.spdata.jianyu360.com/crawl/proxy/socks5/fetch",
+    "proxyauthor": "Basic amlhbnl1MDAxOjEyM3F3ZSFB",
     "luadisablelib": {
         "baselib": {
             "print": false

+ 7 - 0
src/spider/script.go

@@ -613,6 +613,13 @@ func (s *Script) LoadScript(downloadnode, script string, isfile ...string) {
 		S.Push(lua.LString(fid))
 		return 5
 	}))
+	//渲染页面下载
+	s.L.SetGlobal("downloadByRender", s.L.NewFunction(func(S *lua.LState) int {
+		href := S.ToString(-1)
+		contentHtml := util.DownloadByRender(href)
+		S.Push(lua.LString(contentHtml))
+		return 1
+	}))
 }
 
 //