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
dengwen168
V2EX  ›  Python

请教会采集的大佬一个图文采集的问题

  •  
  •   dengwen168 · 2020-04-27 08:27:00 +08:00 · 1572 次点击
    这是一个创建于 1431 天前的主题,其中的信息可能已经有所发展或是发生改变。

    目标网页是长这样的:

    this is a paragraph

    image

    this is a paragraph

    image

    this is a paragraph

    我现在想要将这个网页采集下来,将所有的文字翻译成中文,然后文章中的图片还要保存原来的位置不变, 翻译这块调用接口可以解决,我现在的问题是如何翻译后还能使图片在文章原来的位置。

    请问各位大佬有什么好的办法?谢谢。。

    Bunian
        1
    Bunian  
       2020-04-27 08:32:49 +08:00
    老办法,替换法
    dengwen168
        2
    dengwen168  
    OP
       2020-04-27 08:39:23 +08:00
    @Bunian 我没搞过呀,将图片替换掉么?怎么放回去:)
    locoz
        3
    locoz  
       2020-04-27 08:43:23 +08:00 via Android
    最简单粗暴的办法就是翻译完一段文字就换回去,这样换的就都是文字了
    daozhihun
        4
    daozhihun  
       2020-04-27 08:44:25 +08:00
    你说的采集是什么意思。。。
    加入你是用爬虫爬下来,你提取某个段落的时候肯定是 p 或者 div 之类的标签里吧,翻译以后替换一下不就好了
    dengwen168
        5
    dengwen168  
    OP
       2020-04-27 08:51:51 +08:00
    @locoz 嗯 ,这个方法我也想到过,不过想知道有没有更好的解决方案。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1592 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 16:57 · PVG 00:57 · LAX 09:57 · JFK 12:57
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.