fumer
V2EX  ›  互联网

淘宝现在的 html 都做的这么深?

  •  
  •   fumer · Dec 30, 2014 · 5053 views
    This topic created in 4331 days ago, the information mentioned may be changed or developed.

    http://s.taobao.com/search?q=9787802134379&sort=price-desc&fs=0&fcheckbox_clk=1&tab=all&style=list

    点击右键看到的源代码基本上和页面上展现的没什么关系了。

    这是用到了什么技术

    6 replies  •  2014-12-31 10:23:19 +08:00
    fumer
    fumer
    OP
    Dec 30, 2014
    1
    是为了防爬虫吗?这种页面爬虫是不是也束手无策了
    Daniel65536
    Daniel65536
    Dec 31, 2014 via iPad❤️1
    2
    你看看源代码第四十六行,全在里头,太方便爬虫了。

    这只是用js来生成页面罢了
    lincanbin
    lincanbin
    Dec 31, 2014❤️1
    3
    http://www.taobao.com/robots.txt

    淘宝本来就禁爬虫的,或者说禁百度,实际上对爬虫不友好。
    说用什么技术的话,大概就是前端模板渲染了。
    你可以看看第46行,所有数据都存在Dict里了,这样做的好处是可以在前端用模板渲染,大大节约流量。整个页面才60KiB。
    如果在后端做模板渲染,单页面尺寸会大好几倍的。

    这样做爬虫可以说再方便不过了,直接提取出那一行然后decode,就可以装数据库了。
    typcn
    typcn
    Dec 31, 2014
    4
    方便爬虫+1 找出JSON来,解码一下,结构化数据更省事了

    防的是“小学生”爬虫,比如那种用易语言花钱让别人写正则匹配页面内容的。
    qdwang
    qdwang
    Dec 31, 2014 via Android
    5
    weibo也是一样 还节约了服务器生成页面内容的开销
    xoxo
    xoxo
    Dec 31, 2014
    6
    JSON
    +
    JS模板
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   3668 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 01:24 · PVG 09:24 · LAX 17:24 · JFK 20:24
    ♥ Do have faith in what you're doing.