apt-get install software-properties-common python-software-properties
add-apt-repository ppa:jonathonf/python-3.6
apt-get update
apt-get install python3.6
pip install pyppeteer
pyppeteer-install
apt-get install -y libx11-xcb1 libxrandr2 libasound2 libpangocairo-1.0-0 libatk1.0-0 libatk-bridge2.0-0 libgtk-3-0 libnss3 libxss1
import asyncio
from pyppeteer import launchasync def main():
browser = await launch({'headless':True,'args':['--no-sandbox']}) page = await browser.newPage() url='https://whoer.net/zh' await page.goto(url) await page.screenshot({'path': 'example.png'}) await browser.close()asyncio.get_event_loop().run_until_complete(main())