mirror of
https://github.com/vimagick/dockerfiles
synced 2024-06-27 09:18:43 +00:00
update splash
This commit is contained in:
parent
fcd0a6db87
commit
08bcf6d0c1
@ -1,7 +1,7 @@
|
|||||||
splash
|
splash
|
||||||
======
|
======
|
||||||
|
|
||||||
[`Splash`][1] is a javascript rendering service with an HTTP API. It's a
|
[Splash][1] is a javascript rendering service with an HTTP API. It's a
|
||||||
lightweight browser with an HTTP API, implemented in Python using Twisted and
|
lightweight browser with an HTTP API, implemented in Python using Twisted and
|
||||||
QT.
|
QT.
|
||||||
|
|
||||||
@ -9,7 +9,7 @@ It's fast, lightweight and state-less which makes it easy to distribute.
|
|||||||
|
|
||||||
## docker-compose.yml
|
## docker-compose.yml
|
||||||
|
|
||||||
```
|
```yaml
|
||||||
splash:
|
splash:
|
||||||
image: scrapinghub/splash
|
image: scrapinghub/splash
|
||||||
command: --maxrss 4096
|
command: --maxrss 4096
|
||||||
@ -33,14 +33,14 @@ $ cd ~/fig/splash
|
|||||||
$ tree
|
$ tree
|
||||||
.
|
.
|
||||||
├── docker-compose.yml
|
├── docker-compose.yml
|
||||||
└── splash
|
└── data
|
||||||
├── filters
|
├── filters
|
||||||
│ ├── easylist.txt
|
│ ├── easylist.txt
|
||||||
│ └── default.txt
|
│ └── default.txt
|
||||||
├── js-profiles
|
├── js-profiles
|
||||||
└── proxy-profiles
|
└── proxy-profiles
|
||||||
|
|
||||||
$ cat splash/filters/default.txt
|
$ cat data/filters/default.txt
|
||||||
||fonts.googleapis.com^
|
||fonts.googleapis.com^
|
||||||
||ajax.googleapis.com^
|
||ajax.googleapis.com^
|
||||||
|
|
||||||
@ -53,13 +53,23 @@ $ docker-compose up -d
|
|||||||
|
|
||||||
## client
|
## client
|
||||||
|
|
||||||
```
|
```lua
|
||||||
$ http --proxy http:http://server:8051 http://stackoverflow.com x-splash-render:json x-splash-html:1 x-splash-png:1 x-splash-iframes:1 x-splash-har:1 > so.json
|
-- youtube-logo.lua
|
||||||
$ jq .har so.json | pbcopy
|
|
||||||
$ open http://www.softwareishard.com/har/viewer/
|
|
||||||
|
|
||||||
$ http --proxy http:http://server:8051 http://stackoverflow.com x-splash-render:png > so.png
|
function main(splash)
|
||||||
$ open so.png
|
splash:go('https://www.youtube.com/')
|
||||||
|
splash:wait(0.5)
|
||||||
|
local logo = splash:select('.logo')
|
||||||
|
return logo:png()
|
||||||
|
end
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# whole page
|
||||||
|
$ http http://server:8050/render.png url==https://www.youtube.com > youtube.png
|
||||||
|
|
||||||
|
# only logo
|
||||||
|
$ http http://server:8050/execute lua_source=@youtube-logo.lua > youtube-logo.png
|
||||||
```
|
```
|
||||||
|
|
||||||
[1]: http://splash.readthedocs.org/en/latest/
|
[1]: http://splash.readthedocs.org/en/latest/
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
splash:
|
splash:
|
||||||
image: vimagick/splash
|
image: scrapinghub/splash
|
||||||
command: --maxrss 4096
|
command: --maxrss 4096 --max-timeout 300
|
||||||
ports:
|
ports:
|
||||||
- "8050:8050"
|
- "8050:8050"
|
||||||
- "8051:8051"
|
- "8051:8051"
|
||||||
- "5023:5023"
|
- "5023:5023"
|
||||||
volumes:
|
volumes:
|
||||||
- ./splash/proxy-profiles:/etc/splash/proxy-profiles
|
- ./data/filters:/etc/splash/filters
|
||||||
- ./splash/js-profiles:/etc/splash/js-profiles
|
- ./data/js-profiles:/etc/splash/js-profiles
|
||||||
- ./splash/filters:/etc/splash/filters
|
- ./data/lua_modules:/etc/splash/lua_modules
|
||||||
mem_limit: 4500M
|
- ./data/proxy-profiles:/etc/splash/proxy-profiles
|
||||||
|
mem_limit: 4608M
|
||||||
restart: always
|
restart: always
|
||||||
|
Loading…
Reference in New Issue
Block a user