安卓应用视频抓取通用破解方案
- 网络抓包,搜素关键词:m3u8、flv、mp4 等资源后缀相关的关键词,然后看URL,再在反编译的代码里找该URL的变量或常量,再进一步查找关联引用。
- 播放视频的SDK代码特征入手。
播放SDK相关特征
阿里云播放器
// 应用层代码一般如下
public void startPlayer(TryPlayVideoBean tryPlayVideoBean) {
if (TextUtils.isEmpty(tryPlayVideoBean.getUrl())) {
ToastUtil.show("播放链接为空");
return;
}
this.statusView.setVisibility(8);
this.finishView.setVisibility(8);
this.backgroundView.setVisibility(8);
initAliyunVideo();
SpUtil.getInstance().saveVideoInfo(tryPlayVideoBean.getId(), this.infoBean.getName(), this.infoBean.getCoverImgUrl());
if (this.infoBean.getWidth() < this.infoBean.getHeight()) {
this.aliyunPlayerView.setScreenFullType("portraitFull");
} else {
this.aliyunPlayerView.setScreenFullType("landscapeFull");
}
this.aliyunPlayerView.getPlayerView().setCoverResource(R.mipmap.video_loading_bg);
this.aliyunPlayerView.setSource(tryPlayVideoBean.getUrl(), "");
}
public void setSource(String str, String str2) {
UrlSource urlSource = new UrlSource();
urlSource.setTitle(str2);
if (!TextUtils.isEmpty(str)) {
urlSource.setUri(str);
this.mAliyunVodPlayerView.setLocalSource(urlSource);
}
}
package com.aliyun.vodplayerview.widget;
class AliyunVodPlayerView {
public void setLocalSource(UrlSource urlSource) {
if (this.mAliyunVodPlayer == null) {
return;
}
clearAllSource();
reset();
showNetLoading();
this.mAliyunLocalSource = urlSource;
ControlView controlView = this.mControlView;
if (controlView != null) {
controlView.setForceQuality(true);
}
if (!isLocalSource() && NetWatchdog.is4GConnected(getContext())) {
TipsView tipsView = this.mTipsView;
if (tipsView == null) {
return;
}
tipsView.showNetChangeTipView();
return;
}
prepareLocalSource(urlSource);
this.urlSource0 = urlSource;
}
}
package com.aliyun.player.source;
public class UrlSource extends SourceBase {
private String mUri = null;
private String mCacheFilePath = null;
public UrlSource() {
this.mQuality = "AUTO";
this.mForceQuality = true;
}
public String getUri() {
return this.mUri;
}
public void setUri(String str) {
this.mUri = str;
}
public String getCacheFilePath() {
return this.mCacheFilePath;
}
public void setCacheFilePath(String str) {
this.mCacheFilePath = str;
}
}
所以只要找 com.aliyun.vodplayerview.widget.AliyunVodPlayerView 的函数 setLocalSource 的关联引用处即可,或者 com.aliyun.player.source.UrlSource 的关联引用处。