firewalld基本使用 启动: systemctl start firewalld 查看状态: systemctl status firewalld 停止: systemctl disable firewalld 禁用: systemctl stop firewalld 添加 firewall-cmd –zone=public –add-port=80/tcp –permanent (–permanent永久生效,没有此参数重启后失效) 重新载入 firewall-cmd –reload 删除 firewall-cmd –permanent –remove-port=666/tcp
Mac下用code .使用vscode打开当前目录
vim ~/.bash_profile
export PATH=/Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin:$PATH
#保存退出
source ~/.bash_profile
code . #当前目录就被打开了。
之前看同事用过,找了一下方便很多
smb账户密码修改
账户名work sudo smbpasswd work
盲人站长深恶痛绝的onfocus="this.blur()"
<a href="#" hidefocus="true">链接</a>
a:focus{
outline: none;
}
设置Samba服务器中新建文件/目录的权限
使用root账户
vi /etc/samba/smb.conf
create mode = 0644
force create mode = 0644
directory mode = 0755
force directory mode = 0755
为何express无法监听80端口
其实是可以监听的,只是1024以下端口需要使用root权限。这样会有安全隐患。 所以,可以流量转发。 CentOS7下用firewalld
systemctl start firewalld
firewall-cmd --add-forward-port=port=80:proto=tcp:toport=8080
从0搭建一个nodejs服务器
root账户执行,升级,添加work账户,设置密码,更改权限
yum update
useradd -d /home/work -m work
passwd work
chown -R work:work /home/work
chmod 760 /home/work
visudo
yum install zsh
yum install git
work账户 安装omz https://ohmyz.sh/ 安装nvm https://github.com/creationix/nvm https://github.com/lukechilds/zsh-nvm nvm install nodejs 安装yarn 安装pm2
视频网站视频源地址分析
爱奇艺
视频网页地址:https://m.iqiyi.com/v\_19rr2cvmus.html 页面会请求一个:https://cache.m.iqiyi.com/ 的接口 里面有一个字段m3u,为视频真实地址。 例:http://netcncallcnc.inter.iqiyi.com/videos/v0/20180720/d9/4f/eddadef77066dc7c960ae952ad83d71a.mp4?key=0035d94084c5cd162a40610306413ea4f&dis\_k=30eb0de0f1341eb0bd743fa691a234f3&dis\_t=1533397020&dis\_dz=CNC-BeiJing&dis\_st=44&src=iqiyi.com&uuid=a0d2dd1-5b65c81c-8c&m=v&qd\_k=9cae95479599021a58e7a683114455a3&sgti=13\_3eprs82wn5ib92y1mp2t6jdg\_1533397019752&qd\_ip=7b7118cf&qd\_p=7b7118cf&dfp=a06680c7961c14486e80f314cd8ffd7f6fa7df798edc359fa022c5d2cfdae1b13c&qd\_src=02020031010000000000&ssl=&ip=123.113.24.207&qd\_vip=0&dis\_src=vrs&qd\_uid=0&qdv=1&qd\_tm=1533397020221 有一些参数是可以去掉的。去掉之后: http://111.206.23.7/videos/v0/20180720/16/a4/db018716f61beac599012d45774c272d.mp4?key=0276ea66159aaa4db17c1724b53388ca6&dis\_k=2742e7645a8ed2f8dc1aaad964db9072b&dis\_t=1533395921&dis\_dz=CNC-BeiJing&dis\_st=44&qd\_k=52207238abb1ee50c64941d94d60a8be&qd\_ip=7b7118cf&qd\_src=02020031010000000000&qd\_vip=0&qd\_uid=0 必需参数: key: 0276ea66159aaa4db17c1724b53388ca6 dis_k: 2742e7645a8ed2f8dc1aaad964db9072b dis_t: 1533395921 dis_dz: CNC-BeiJing dis_st: 44 qd_k: 52207238abb1ee50c64941d94d60a8be qd_ip: 7b7118cf qd_src: 02020031010000000000 qd_vip: 0 qd_uid: 0
优酷
视频网页地址:https://m.youku.com/video/id_XMzc1MDQ5NjcyMA==.html 接口域名:https://ups.youku.com 字段:data->stream->segs 做了分片,顺序还没查清楚。扒起来可能比较困难。 iframe播放器(https也可以)
<iframe height=498 width=510 src='http://player.youku.com/embed/XMzc1MDQ5NjcyMA==' frameborder=0 'allowfullscreen'></iframe>
后面为页面id,看样子可以批量搞定。
bilibili
视频网页地址: https://www.bilibili.com/video/av28191680 视频地址:blob:https://www.bilibili.com/eeb8740a-3671-4405-9ab2-9177204949eb
<iframe src="//player.bilibili.com/player.html?aid=28191680&cid=48730521&page=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"> </iframe>
实际只需要av后面的id即可 https://m.bilibili.com/video/av28191680.html 接口:https://api.bilibili.com/playurl durl->url
DOMException: The play() request was interrupted
项目用遇到了这个问题。 产生问题的原因:调用play之后执行pause。而此时play方法可能还没执行完。 查了一下谷歌这面有解决方案。 https://developers.google.com/web/updates/2017/06/play-request-was-interrupted 第一种解决方案
<video id="video" preload="none" src="https://example.com/file.mp4"></video>
<script>
// Show loading animation.
var playPromise = video.play();
if (playPromise !== undefined) {
playPromise.then(_ => {
// Automatic playback started!
// Show playing UI.
// We can now safely pause video...
video.pause();
})
.catch(error => {
// Auto-play was prevented
// Show paused UI.
});
}
</script>
第二种解决方案
<video id="video"></video>
<button id="button"></button>
<script>
button.addEventListener('click', onButtonClick);
function onButtonClick() {
// This will allow us to play video later...
video.load();
fetchVideoAndPlay();
}
function fetchVideoAndPlay() {
fetch('https://example.com/file.mp4')
.then(response => response.blob())
.then(blob => {
video.srcObject = blob;
return video.play();
})
.then(_ => {
// Video playback started ;)
})
.catch(e => {
// Video playback failed ;(
})
}
</script>
Git update after fork
git remote -v
git remote add upstream http://github/xxxxx/xxxx
git fetch upstream
git merge upstream/master
git push origin master