2024-05-15 23:20:41 发布
网友
我试图通过python下载一个emmbedded链接,下面是一个示例链接
https://matterhorn.dce.harvard.edu/engage/player/watch.html?id=f7ff1893-fbf7-4909-b44e-12e61a98a677
当我导航到该页面时,需要加载一些内容,还必须按play键
任何帮助都将不胜感激。在
如果您要查看页面的生成源代码(在加载DOM并运行javascript代码之后),您将看到它是一个HTML页面(而不是指向视频的链接)。源代码包含生成此html的javascript代码:
<div id="playerContainer_videoContainer_container" role="main" style="position: relative; display: block; margin-left: auto; margin-right: auto; width: 1902px; height: 1070px; top: 0px;"> <div id="overlayContainer" role="main" style="position: absolute; left: 0px; right: 0px; top: 0px; bottom: 0px; overflow: hidden; z-index: 10;"></div> <img id="playerContainer_videoContainer_bkg" src="config/profiles/resources/slide_professor_paella.jpg" alt="" width="100%" height="100%" style="position: relative; top: 0px; left: 0px; right: 0px; bottom: 0px; z-index: 0;"> <video id="playerContainer_videoContainer_1" preload="auto" style="top: 18.4722%; left: 0.390625%; width: 65%; height: 65%; position: absolute; z-index: 1;" poster="https://da4w749qm6awt.cloudfront.net/engage-player/f7ff1893-fbf7-4909-b44e-12e61a98a677/attachment-5/presenter_delivery.jpg"> <source src="https://da4w749qm6awt.cloudfront.net/engage-player/f7ff1893-fbf7-4909-b44e-12e61a98a677/24320288-b79e-49e5-93b6-96b4c208f8cb/presenter_delivery.mp4" type="video/mp4"> </video> <video id="playerContainer_videoContainer_2" preload="auto" style="top: 33.4722%; left: 66.0156%; width: 33.75%; height: 33.75%; position: absolute; z-index: 1;" poster="https://da4w749qm6awt.cloudfront.net/engage-player/f7ff1893-fbf7-4909-b44e-12e61a98a677/attachment-8/presentation_delivery.jpg"> <source src="https://da4w749qm6awt.cloudfront.net/engage-player/f7ff1893-fbf7-4909-b44e-12e61a98a677/93271e20-3f4b-4650-a7e3-95aac41fd3e5/presentation_delivery.mp4" type="video/mp4"> </video>
所以你真正想要下载的文件是
如果选中network选项卡(在开发人员工具栏中),您会注意到有一个ajax请求指向以下url:
network
https://matterhorn.dce.harvard.edu/search/episode.json?id=f7ff1893-fbf7-4909-b44e-12e61a98a677&_=1477764682940
(您可以看到这里的id与原始URL中的id相同)。在
id
此请求的响应是一个json字符串:
{"search-results":{"searchTime":"1","total":"1","limit":"1","offset":"0","query":"(id:f7ff1893\\-fbf7\\-4909\\-b44e\\-12e61a98a677) AND oc_organization:mh_default_org AND (o
Only partial response, since it's too big to put here.
部分回应是:
search-results.result.mediapackage.media.track
其中有6个项目,每个项目都有一个URL属性,可用于获取相关视频链接:
我认为这些信息给了你一个很好的起点:)
如果您要查看页面的生成源代码(在加载DOM并运行javascript代码之后),您将看到它是一个HTML页面(而不是指向视频的链接)。源代码包含生成此html的javascript代码:
所以你真正想要下载的文件是
^{pr2}$如果选中
network
选项卡(在开发人员工具栏中),您会注意到有一个ajax请求指向以下url:(您可以看到这里的
id
与原始URL中的id相同)。在此请求的响应是一个json字符串:
部分回应是:
其中有6个项目,每个项目都有一个URL属性,可用于获取相关视频链接:
我认为这些信息给了你一个很好的起点:)
相关问题 更多 >
编程相关推荐