lxsunbin
V2EX  ›  问与答

iframe 引用 b 站视频失败?

  •  
  •   lxsunbin · Dec 12, 2017 · 3053 views
    This topic created in 3262 days ago, the information mentioned may be changed or developed.
    <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> </head> <body> <iframe src="http://www.bilibili.com/blackboard/html5player.html?aid=14387031&cid=23475167" width="920" height="500" frameborder="no"></iframe> </body> </html>

    iframe 里面的地址直接输入到浏览器就可以看,但是用 iframe 引用就不显示,求解如何处理?

    9 replies  •  2017-12-13 09:07:59 +08:00
    dilu
    dilu
    Dec 12, 2017
    1
    可能对来源进行了验证,具体原因不好说,建议模拟一下 http 头 把自己伪装成正常用户,例如随机的 UA,首页或者别的几个随机来源等等,然后把抓取的 html 代码直接扔到 iframe 中也是可以的
    lxsunbin
    lxsunbin
    OP
    Dec 12, 2017
    2
    @dilu 求解如何模拟,没搞过这个
    awanabe
    awanabe
    Dec 12, 2017
    3
    js 动态写入 iframe 可破 refer
    love4taylor
    love4taylor
    Dec 12, 2017
    4
    /t/409793 跟我之前一样的问题 233333
    用主站播放器试试(我这之前可以现在也空白了..) https://www.bilibili.com/blackboard/player.html
    Ovrase
    Ovrase
    Dec 12, 2017
    5
    问过官方人员,目前外链播放器是在重构...大概短期还解决不了吧
    lxsunbin
    lxsunbin
    OP
    Dec 12, 2017
    6
    @Love4Taylor 我也是之前可以现在空白,很难受
    dilu
    dilu
    Dec 12, 2017
    7
    @lxsunbin 用 curl 这个扩展 模拟 GET 请求 把抓取的 html 代码进行正则匹配 只把播放器的代码抠出来 然后扔到 iframe 中 虽然这个特别浪费资源但是目前只能这样了 先把功能做出来 后面再说
    lxsunbin
    lxsunbin
    OP
    Dec 12, 2017
    8
    @dilu 没用过这个,貌似是 PHP 和 Linux 上的?
    dilu
    dilu
    Dec 13, 2017
    9
    @lxsunbin 是一个 linux 工具可以模拟 get/post 登录等等 功能强大 php 可以调用 或者用你自己擅长的语言 肯定有 curl 的
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   4127 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 09:27 · PVG 17:27 · LAX 01:27 · JFK 04:27
    ♥ Do have faith in what you're doing.