GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — learning-python/web at master · feixiao/learning-python

Expand file tree

/

web

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
/

web

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
README.md
README.md
 
 
main.py
main.py
 
 
requirements.txt
requirements.txt
 
 

README.md

Outline

网页下载脚本(服务器可用)

web/main.py 支持三种下载方式:

  • requests:保存原始 HTML(轻量,可能不含前端渲染结果)
  • selenium:渲染后保存 HTML + 整页截图(需要 Chrome/Chromedriver)
  • playwright:渲染后保存 HTML + 整页截图(推荐服务器,自动管理 Chromium)

快速开始(requests,最简单)

python web/main.py \
  --method requests \
  --out web/cnn-fear-and-greed.html \
  'https://sc.macromicro.me/charts/50108/cnn-fear-and-greed'

服务器推荐(playwright)

# 1) 安装依赖
pip install playwright
# 2) 安装浏览器及依赖(Linux 服务器推荐 --with-deps)
python -m playwright install --with-deps chromium

# 3) 运行渲染下载:保存渲染后的 HTML 和全页截图
python web/main.py \
  --method playwright \
  --out-html web/cnn-fear-and-greed_rendered.html \
  --out-png  web/cnn-fear-and-greed.png \
  --wait 6 \
  'https://sc.macromicro.me/charts/50108/cnn-fear-and-greed'

备选(selenium,本机有 Chrome 时)

pip install selenium
python web/main.py \
  --method selenium \
  --out-html web/cnn-fear-and-greed_rendered.html \
  --out-png  web/cnn-fear-and-greed.png \
  --wait 8 \
  'https://sc.macromicro.me/charts/50108/cnn-fear-and-greed'

说明

  • 仅保存 HTML 不会打包外部静态资源;若需要“所见即所得”,请使用 playwright/selenium 并查看 PNG 截图。
  • --wait 用于等待页面的异步内容加载;可按网络情况调整。
  • Playwright 会在首次运行后缓存浏览器,适合无桌面环境的服务器。
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.