V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
Zhepro
V2EX  ›  Python

Python 怎么把 html 文件里的 mp4 视频提取出来?

  •  
  •   Zhepro · 2020-06-19 21:02:43 +08:00 · 2806 次点击
    这是一个创建于 1405 天前的主题,其中的信息可能已经有所发展或是发生改变。
    用 code 打开是这样的:
    <video width="950" height="950" controls autoplay loop>
    <source type="video/mp4" src="data:video/mp4;base64,---一堆字母--->
    Your browser does not support the video tag.
    </video>
    用 chrome 倒是可以手动下载,但是想批量提取,怎么弄呢
    5 条回复    2020-06-20 08:15:11 +08:00
    crab
        1
    crab  
       2020-06-19 21:07:46 +08:00
    b64decode
    xiri
        2
    xiri  
       2020-06-19 21:07:47 +08:00
    把 base64 后面那一堆字符拿出来,然后用 base64 解码
    lqzhgood
        3
    lqzhgood  
       2020-06-19 21:10:54 +08:00
    视频也压 base64~~ 是个狠人呀
    iConnect
        4
    iConnect  
       2020-06-19 23:50:52 +08:00 via Android
    应该是找 .ts 文件地址,下载拼接起来
    kof21411
        5
    kof21411  
       2020-06-20 08:15:11 +08:00
    lists = etree.HTML(html)
    infos = lists.xpath("//video/source/@src")
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5389 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 07:28 · PVG 15:28 · LAX 00:28 · JFK 03:28
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.