推荐学习书目
› 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 · Apr 27, 2020 · 2840 views
    This topic created in 2342 days ago, the information mentioned may be changed or developed.

    目标网页是长这样的:

    this is a paragraph

    image

    this is a paragraph

    image

    this is a paragraph

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

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

    Bunian
        1
    Bunian  
       Apr 27, 2020
    老办法,替换法
    dengwen168
        2
    dengwen168  
    OP
       Apr 27, 2020
    @Bunian 我没搞过呀,将图片替换掉么?怎么放回去:)
    locoz
        3
    locoz  
       Apr 27, 2020 via Android
    最简单粗暴的办法就是翻译完一段文字就换回去,这样换的就都是文字了
    daozhihun
        4
    daozhihun  
       Apr 27, 2020
    你说的采集是什么意思。。。
    加入你是用爬虫爬下来,你提取某个段落的时候肯定是 p 或者 div 之类的标签里吧,翻译以后替换一下不就好了
    dengwen168
        5
    dengwen168  
    OP
       Apr 27, 2020
    @locoz 嗯 ,这个方法我也想到过,不过想知道有没有更好的解决方案。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2494 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 07:17 · PVG 15:17 · LAX 00:17 · JFK 03:17
    ♥ Do have faith in what you're doing.