wico77
V2EX  ›  问与答

python 如何解析 js 里的数据

  •  
  •   wico77 · Jul 17, 2016 · 3868 views
    This topic created in 3619 days ago, the information mentioned may be changed or developed.

    目标网站里的 JS 数据如下<script type="text/javascript">window._sharedData = {"country_code": "DE", "language_code": "en", "gatekeepers": {"sulgin": true},。。。</script> 我想能不能在 python 下很好的解析这种类似 json 的数据

    3 replies    2016-07-18 16:43:37 +08:00
    paulw54jrn
        1
    paulw54jrn  
       Jul 17, 2016
    做爬虫吗?
    可以用个 headless browser.
    比如说 http://www.seleniumhq.org/
    jugelizi
        2
    jugelizi  
       Jul 17, 2016
    ⊙﹏⊙b 汗
    简单的直接截取 替换就拿到 json 数据了都不需要 js 解释器
    jeremaihloo
        3
    jeremaihloo  
       Jul 18, 2016 via Android
    直接截取直接用呀
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   4358 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 44ms · UTC 05:33 · PVG 13:33 · LAX 22:33 · JFK 01:33
    ♥ Do have faith in what you're doing.