*video标签在微信公众号上出现的一些问题*

**video标签在微信公众号上出现的一些问题**

1,在微信公众号Android和iOS 视频播放禁止放大

video标签上添加属性 video.attr('playsinline','true'); video.attr('x5-playsinline','true');

2,Android在微信端视频播放完之后推荐不相关的内容

···
let isiOS = !!navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); // 判断是否是iOS
if (!isiOS) {
    video.play();
    setTimeout(() => {
        video.pause();
    }, 100)
}
监听播放进度条是否拖动
var video = document.querySelector('video');
var supposedCurrentTime = 0;
var allowSeekTime = 1; // max allow seek time in seconds
监听当前的播放位置发送改变时触发。
video.addEventListener('timeupdate', function() {
if (!video.seeking) {
supposedCurrentTime = video.currentTime;
}
});
// prevent user from seeking
寻址中(Seeking)指的是用户在音频/视频中移动/跳跃到新的位置。
video.addEventListener('seeking', function() {
var delta = video.currentTime - supposedCurrentTime;
if (Math.abs(delta) > allowSeekTime) {
console.log("Seeking is disabled");
video.currentTime = supposedCurrentTime;
}
});
// delete the following event handler if rewind is not required
let isiOS = !!navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)
监听视频播放完成
video.addEventListener('ended', function() {
// reset state in order to allow for rewind
supposedCurrentTime = 0;
if (!isiOS) {
video.play();
setTimeout(() => {
video.pause();
}, 100)
}

});

监听微信后退事件
window.addEventListener("popstate", function(e) {
 // _this.$router.go(0)
}, false);

···

您好!要使用Python爬取微信公众号的视频,可以按照以下步骤进行操作: 1. 安装必要的库:使用pip安装requests、beautifulsoup4和lxml库。 2. 模拟登录微信公众平台:使用requests库发送登录请求,获取登录所需的参数和Cookie,并保存下来。 3. 获取文章列表:使用requests库发送请求,获取公众号文章列表的HTML页面。 4. 解析文章列表:使用beautifulsoup4和lxml库解析HTML页面,提取出文章标题和链接。 5. 进入文章页面:使用requests库发送请求,进入文章页面。 6. 解析文章页面:使用beautifulsoup4和lxml库解析文章页面,找到视频所在的标签。 7. 下载视频:使用requests库下载视频文件。 以下是一个简单的示例代码,供您参考: ```python import requests from bs4 import BeautifulSoup # 模拟登录微信公众平台 def login(): login_url = 'https://***.weixin.qq.com/cgi-bin/bizlogin?action=login' # 发送登录请求,获取登录所需的参数和Cookie # ... # 获取文章列表 def get_article_list(): article_list_url = 'https://***.weixin.qq.com/cgi-bin/appmsg?...' # 发送请求,获取公众号文章列表的HTML页面 # ... # 解析HTML页面,提取出文章标题和链接 # ... # 进入文章页面 def enter_article(article_url): # 发送请求,进入文章页面 # ... # 解析文章页面,找到视频所在的标签 # ... # 下载视频 def download_video(video_url): # 使用requests库下载视频文件 # ... # 主函数 def main(): # 登录微信公众平台 login() # 获取文章列表 article_list = get_article_list() for article in article_list: # 进入文章页面 article_url = article['url'] enter_article(article_url) # 下载视频 video_url = get_video_url() download_video(video_url) if __name__ == '__main__': main() ``` 请注意,这只是一个示例代码,实际操作可能会有一些差异。不过,通过以上步骤,您应该能够基本实现使用Python爬取微信公众号的视频。祝您成功!如果有任何问题,请随时向我提问。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值