这里是返回的文本内容
videojs('video', {
poster: 'https://cdn.xxx.com/images/pinporn/2021/07/15/25557512.jpg?width=620',
controls: true,
//width: 'auto',
//height: 'auto',
controlBar: {
volumeMenuButton: {
inline: false,
vertical: true
}
},
plugins: {
videoJsResolutionSwitcher: {
'default': 'low',
dynamicLabel: true
}
}
}, function() {
var player = this;
// Add dynamically sources via updateSrc method
player.updateSrc([
{
src: '/video/stream/994331',#想要提取的文本,但是不知道该使用哪个元素,src,player.updateSrc,用re还有bs试过,不清楚是不是格式问题总是无法识别
type: 'video/mp4',
label: 'SD',
res: 360
},
]);
player.on('play', function() {
var adDiv = document.getElementById('ad-div');
if (adDiv) {
adDiv.parentNode.removeChild(adDiv);
}
});
});
import requests
import re
from bs4 import BeautifulSoup
url = 'https://www.xxx.com/pin/62335062/'
headers={'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36'}
resp=requests.get(url,headers=headers)
bs=BeautifulSoup(resp.text,'lxml')
v1=bs.findAll('src:')
print(v1)#bs找
v1=re.compile('player.updateSrc(.+)player.on')
v2=v1.findall(resp.text)
print(v2)#用re找