Chrome 开发必装插件
清除浏览器缓存:chrome://settings/clearBrowserData
强制https设置:chrome://net-internals/#hsts
管理扩展程序:chrome://extensions/
清除 DNS 缓存:chrome://net-internals/#dns
- chrome://settings/
- 系统
- 使
使用图形加速功能(如果可用)
保持关闭
清除浏览器缓存:chrome://settings/clearBrowserData
强制https设置:chrome://net-internals/#hsts
管理扩展程序:chrome://extensions/
清除 DNS 缓存:chrome://net-internals/#dns
使用图形加速功能(如果可用)
保持关闭FTP
即 File Transfer Protocol 文件传输协议。
客户端与服务端建立会话,双方启动控制进程,用到TCP的21端口,利用此端口控制文件是上传还是下载,删除或是复制等操作命令,真正的数据传输走的是另外的端口。
Markdown 使用总结
1 | C:\Users\Administrator>d: |
1 | D:> dir |
1 | D:> md java |
1 | D:> cd java |
1 | echo name:Tom,age:12>1.doc |
1 | del 1.doc |
remove directory
1 | # 删除空目录 |
可到这里下载powerline字体, 我使用的是UbuntuMono, 配合vim-airline
使用。
1 | brew install ack |
Neovim
Vim Plug to install extensions
coc.nvim for autocompletion and imports and type definitions
ctrl-space
autocompletiongd
goto definitionF2
renameK
show tooltip- created coc-pref.json
- :CocInstall coc-snippets
- :CocCommand snippets.editSnippets
Gruvbox theme
yats for typescript syntax
nerdtree for file tree
- auto open
- install fira font
Plug ‘tsony-tsonev/nerdtree-git-plugin’ Plug ‘tiagofumo/vim-nerdtree-syntax-highlight’ Plug ‘ryanoasis/vim-devicons’
nerdcommenter
cmd /
comment out code- (mapped to ++ so cmd / can be mapped)
ctrlp.vim for fuzzy file finder
cmd p
opencmd keybindings required iTerm2 remappings
vim-gitgutter tells you what lines you modified
参考自:https://www.notion.so/Vim-Setup-0586a2ae8466442daa293ad1297bdcd0
N1 系统安装完成后,为了使外网登录更加安全,本篇将介绍如何把 ssh 密码
登录方式改为 ssh 证书
免密登录。
ddrk m3u8视频源地址解码
低端影视
网站可观看各种电影,网速及分辨率也满足需求,但唯独没有视频对应下载地址(网络高峰期不给力,经常卡顿,无法正常观影~),通过网络请求分析,应该是 m3u8 格式的资源。
这里以星际迷航电影源解析为例:
打开链接地址 https://ddrk.me/star-trek-discovery/?ep=1,打开 chrome 开发者工具,在 network 面板中监听 XHR
异步网络请求,点击视频可观察到:
第一个 video
请求应该就是 m3u8 文件的 index,但响应值中的 pin
明显是加密过的。
接着通过 Sources
面板,全局搜索下源代码中的 pin
关键字,最终找到相关后续处理的 javascript 代码,里面有 ungzip
关键字,可得出是 pin
值通过 gzip
加密的。
而这里也可以看出结果是通过第三方库 pako
,接着我们本地搭建下开发环境,模拟解析下 pin
值,示例代码如下:
1 | <!DOCTYPE html> |
服务端对应做了个可跨域请求接口,PHP
代码如下:
1 | public function corsAction() { |
此时访问前端页面,即可解出 index 地址。
index 请求地址有时效性,过期后需要重新获取 index 地址。
index 地址做了 origin
限制,需要在服务端做个跨域中转请求,才能拿到其响应数据。
index 中的 ts 地址没有时间限制。
今天接到任务需要抓取下我司抖音号里所有视频的:点赞数、评论数、转发数 数据。大概是因为临近年终了。。。
开启代理工具
手机添加代理
打开抖音App,进入对应抖音账号,开始抓取数据,重复通过手势向上滑动以加载更多数据,直至显示所有视频。
抓包完毕。
1 | $ npm i -g whistle whistle.autosave mysql --registry=https://registry.npmmirror.com |
whistle
网络数据抓包。whistle.autosave
whistle 官方插件,默认将 response 数据记录到文件。对其改造(仅获取需要的字段数据)并存储至数据库。mysql
MySQL 数据库操作包,用于将数据存储到数据库。通过 w2 run
启动 whistle
抓包工具。
在抓取数据之前需要找到对应数据 URL
和 response
字段。
https://api3-core-c-hl.amemv.com/aweme/v1/aweme/post/
https://api5-core-c-hl.amemv.com/aweme/v1/aweme/post/
https://www.iesdouyin.com/share/video/${aweme_id}
涉及字段
resBody
是JSON
格式的 body 数据。
resBody.aweme_list[i].statistics.digg_count
点赞数量resBody.aweme_list[i].aweme_id
视频IDresBody.aweme_list[i].desc
视频描述resBody.aweme_list[i].statistics.comment_count
评论数量resBody.aweme_list[i].statistics.share_count
转发数量resBody.aweme_list[i].create_time
发布时间resBody.aweme_list[i].duration
视频时长通过 抓包数据分析
得知,host
是变动的,而剩下的 URI
是固定格式。
浏览器,打开 http://127.0.01:8899/#plugins
地址,添加过滤条件 /aweme\/v1\/aweme\/post/
,这时只有匹配到过滤条件的请求才会请求到 whistle.autosave
插件。
1 | CREATE TABLE `douyin` ( |
1 | $ cd $(npm root -g)/whistle.autosave/lib |
编辑文件 resStatsServer.js
,代码修改如下:
1 | const fs = require('fs'); |
1 | $ w2 run |
我同事之前也做过类似的事情,但通过的是第三方平台再处理的数据。跟同事要来了一份数据,对比下第三方平台数据与原数据的差异:
1 | SELECT |
2. 计算差异
1 | -- select count(*) from dylist where name = 'xxx' and `publish_time` > 1602604800; |
部分视频可以直接通过 URL
获取,有时限(过一段时间后将无法获取数据)。
https://api3-core-c-hl.amemv.com/aweme/v1/aweme/post/?page_from=1&user_id=3293759164133159&publish_video_strategy_type=2
https://api3-core-c-hl.amemv.com/aweme/v1/aweme/post/?page_from=2&user_id=68310389333&publish_video_strategy_type=2
https://api3-core-c-hl.amemv.com/aweme/v1/aweme/post/?count=21&publish_video_strategy_type=2&page_from=2&user_id=566969479994331