Skip to content
This repository has been archived by the owner on Apr 3, 2024. It is now read-only.

Commit

Permalink
fix malimali source
Browse files Browse the repository at this point in the history
  • Loading branch information
670848654 committed Jun 30, 2022
1 parent 3e17c26 commit 40a4a07
Show file tree
Hide file tree
Showing 22 changed files with 258 additions and 291 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "my.project.sakuraproject"
minSdkVersion 21
targetSdkVersion 30
versionCode 41
versionName "2.3.2"
versionCode 42
versionName "2.3.3"
ndk{abiFilters "arm64-v8a", "x86_64"}
resConfigs"zh"
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
android:configChanges="screenLayout|orientation|screenSize|smallestScreenSize|keyboardHidden|uiMode"
android:hardwareAccelerated="true"
android:screenOrientation="portrait"
android:theme="@style/AppTheme" />
android:theme="@style/TranslucentTheme" />
<activity
android:name=".main.tag.TagActivity"
android:configChanges="screenLayout|orientation|screenSize|smallestScreenSize|keyboardHidden|uiMode"
Expand Down
12 changes: 12 additions & 0 deletions app/src/main/java/my/project/sakuraproject/api/Api.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package my.project.sakuraproject.api;

import com.arialyy.annotations.M3U8;

public class Api {
//检测更新
public final static String CHECK_UPDATE = "https://api.github.com/repos/670848654/SakuraAnime/releases/latest";
Expand All @@ -17,4 +19,14 @@ public class Api {
public final static String MALIMALI_CHINA = "9";
public final static String MALIMALI_JAPAN = "10";
public final static String MALIMALI_EUROPE = "11";

// 免费的VIP解析接口用于解析类似: https://v.qq.com/x/cover/ww18u675tfmhas6/v0034fqhcph.html
public final static String[] PARSE_TITLES = new String[] {"思古解析", "夜幕解析", "虾米解析", "M3U8.TV解析", "纯净/B站解析 [使用WebView播放]"};
public final static String[] PARSE_INTERFACE = new String[] {
"https://jsap.attakids.com/?url=%s",
"https://www.yemu.xyz/?url=%s",
"https://jx.xmflv.com/?url=%s",
"https://jx.m3u8.tv/jiexi/?url=%s",
"https://z1.m1907.cn/?jx=%s"
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ public void showUpdateLogs() {

public List createUpdateLogList() {
List logsList = new ArrayList();
logsList.add(new LogBean("版本:2.3.1", "修复在下载过程中应用异常退出后再进行继续下载时TS转换器被回收导致下载完成后无法合并的问题\n修复Aria下载框架使用不当存在内存泄露的问题\n*本次更新后建议先手动删除所有下载失败的剧集,否则可能出现数据错乱...\n**选择多集批量下载时有时会出现未创建下载任务的情况,如出现该问题请删除未执行下载剧集后自行重新下载"));
logsList.add(new LogBean("版本:2.3.3", "malimali域名变更为https://www.malimali6.com\n修复malimali源站点UI改版导致所有相关解析出错的问题\nmalimali源新增当视频地址是链接到腾讯视频等视频网站资源时,在播放失败时选择网页嗅探时加入了几个免费的VIP视频解析接口(不保证长期有效),下载该类型的视频时同理,但不保证一定能嗅探成功\n**由于malimali源站点改版导致部分番剧的地址发生变化可能导致在我的收藏、历史记录等界面操作时出现崩溃的情况,如出现请手动删除相关信息"));
logsList.add(new LogBean("版本:2.3.2", "修复在下载过程中应用异常退出后再进行继续下载时TS转换器被回收导致下载完成后无法合并的问题\n修复Aria下载框架使用不当存在内存泄露的问题\n*本次更新后建议先手动删除所有下载失败的剧集,否则可能出现数据错乱...\n**选择多集批量下载时有时会出现未创建下载任务的情况,如出现该问题请删除未执行下载剧集后自行重新下载"));
logsList.add(new LogBean("版本:2.3.1", "尽可能修复M3U8下载时可能出现下载失败的情况(下载时不建议批量下载过多的视频)\n*目前发现MaliMali源有些视频因资源问题导致无法播放,可尝试下载,如果能下载成功可尝试使用你的外置播放器进行播放"));
logsList.add(new LogBean("版本:2.3.0", "由于imomoe源访问变成dmh8.com(怕是凉了),番剧画质差且视频中夹带非法广告,现移除imomoe源解析替换为质量不错的malimali源,更新后将清空所有imomoe源的存储信息(下载除外)。\n修复伪装为图片格式的M3U8下载完成后合并的文件无法播放的问题。"));
logsList.add(new LogBean("版本:2.2.0", "修改首页UI,移除侧滑栏,不再将时间表作为首页展示内容\n修复下载M3U8视频失败时无法删除任务的问题\n移除设置同时下载数量功能(功能存在问题),暂设置默认下载数量为1\n修复投屏功能目前发现的一些问题\n修复我的追番列表、历史记录、下载列表中的番剧图片地址更换而无法显示的问题,更新新的图片地址存入数据库\n修改历史记录、下载列表中列表数据UI呈现样式"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,6 @@ public void setStatusBarColor() {
!getRunningActivityName().equals("PlayerActivity") &&
!getRunningActivityName().equals("LocalPlayerActivity") &&
!getRunningActivityName().equals("ImomoePlayerActivity") &&
!getRunningActivityName().equals("DefaultX5WebActivity") &&
!getRunningActivityName().equals("X5WebActivity") &&
!getRunningActivityName().equals("DefaultNormalWebActivity") &&
!getRunningActivityName().equals("NormalWebActivity") &&
!getRunningActivityName().equals("DLNAActivity")) {
if (gtSdk23()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ public void onTagClick(int position, String text) {
if (!isImomoe)
startActivity(new Intent(DescActivity.this, AnimeListActivity.class).putExtras(bundle));
else {
if (sakuraUrl.contains("/voddetail/") && animeListBean.getTagUrls().get(position).contains("-"))
/*if (sakuraUrl.contains("/voddetail/") && animeListBean.getTagUrls().get(position).contains("-") || animeListBean.getTagTitles().equals("动漫"))
startActivity(new Intent(DescActivity.this, SearchActivity.class).putExtras(bundle));
else {
Bundle tagBundle = new Bundle();
Expand All @@ -415,7 +415,8 @@ public void onTagClick(int position, String text) {
break;
}
startActivity(new Intent(DescActivity.this, MaliTagActivity.class).putExtras(tagBundle));
}
}*/
CustomToast.showToast(DescActivity.this, "暂不支持", CustomToast.WARNING);
}
}

Expand Down Expand Up @@ -836,14 +837,23 @@ private void createDownloadConfig() {
* 单集解析下载
*/
private void downloadSingleParse(int position) {
alertDialog = Utils.getProDialog(DescActivity.this, R.string.create_parse_download_task);
createDownloadConfig();
if (!isImomoe) {
alertDialog = Utils.getProDialog(DescActivity.this, R.string.create_parse_download_task);
createDownloadConfig();
String yhdmUrl = downloadBean.get(position).getYhdmUrl();
yhdmUrl = String.format(Api.PARSE_API, yhdmUrl);
SniffingUtil.get().activity(this).referer(yhdmUrl).callback(this).url(yhdmUrl).position(position).start();
String url = String.format(Api.PARSE_API, downloadBean.get(position).getYhdmUrl());
SniffingUtil.get().activity(this).referer(url).callback(this).url(url).position(position).start();
} else {
CustomToast.showToast(this, "不支持的下载格式", CustomToast.ERROR);
VideoUtils.showParseAlert(this, (dialog, index) -> {
dialog.dismiss();
String url = String.format(Api.PARSE_INTERFACE[index], downloadBean.get(position).getYhdmUrl());
if (index == Api.PARSE_INTERFACE.length -1) {
cancelDialog();
Toast.makeText(this, "该接口仅用于WebView播放!", Toast.LENGTH_SHORT).show();
} else {
SniffingUtil.get().activity(this).referer(url).callback(this).url(url).start();
Toast.makeText(this, Utils.getString(R.string.select_parse_interface_msg), Toast.LENGTH_LONG).show();
}
});
}
}

Expand Down Expand Up @@ -884,7 +894,7 @@ public void showYhdmVideoSuccessView(YhdmVideoUrlBean yhdmVideoUrlBean, String p
break;
}
}
Toast.makeText(getApplicationContext(), playNumber + " -> 下载出错,可能需要解析后才能下载~" , Toast.LENGTH_SHORT).show();
Toast.makeText(getApplicationContext(), playNumber + " -> 下载出错,可能需要解析后才能下载" , Toast.LENGTH_SHORT).show();
}
cancelDialog();
});
Expand All @@ -911,14 +921,26 @@ public void getVideoError(String playNumber) {
@Override
public void showSuccessImomoeVideoUrlsView(String url, String playNumber) {
runOnUiThread(() -> {
cancelDialog();
if (url.endsWith("html")) {
for (DownloadDramaBean downloadDramaBean : downloadBean) {
if (downloadDramaBean.getTitle().equals(playNumber)) {
downloadDramaBean.setYhdmUrl(url);
downloadDramaBean.setShouldParse(true);
downloadDramaBean.setSelected(false);
break;
}
}
Toast.makeText(getApplicationContext(), playNumber + " -> 下载出错,可能需要解析后才能下载" , Toast.LENGTH_SHORT).show();
return;
}
long taskId;
String fileSavePath = savePath + playNumber;
taskId = createDownloadTask(url.endsWith(".m3u8"), url, fileSavePath);
DatabaseUtil.insertDownload(animeTitle, source, animeListBean.getImg(), sakuraUrl);
DatabaseUtil.insertDownloadData(animeTitle, source, playNumber, 0, taskId);
Log.e("Malimali", animeTitle + "," + source + "," + animeListBean.getImg() + "," + sakuraUrl + ","+ playNumber + "," + taskId);
startDownloadService();
cancelDialog();
});
}
/************************************************************ m3u8下载配置 START ************************************************************/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ public void onResponse(Call call, Response response) {
//创建番剧索引
DatabaseUtil.addAnime(animeTitle, 1);
fid = DatabaseUtil.getAnimeID(animeTitle, 1);
Log.e("fid", fid);
// 添加历史记录
DatabaseUtil.addOrUpdateHistory(fid, animeListBean.getUrl(), animeListBean.getImg());
//是否收藏
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,12 @@ public class HomeActivity extends BaseActivity<HomeContract.View, HomePresenter>

@Override
protected HomePresenter createPresenter() {
return new HomePresenter(false, "", this);
return new HomePresenter(false, this);
}

@Override
protected void loadData() {
if (Utils.isImomoe())
mPresenter.loadMailiHtmlData();
else
mPresenter.loadData(true);
mPresenter.loadData(true);
}

@Override
Expand Down Expand Up @@ -319,13 +316,6 @@ public void showUpdateInfoSuccess(List<AnimeUpdateInfoBean> beans) {
animeUpdateInfoBeans = beans;
}

@Override
public void showMaliWeekInfoSuccess(String html) {
maliHtml = html;
mPresenter = new HomePresenter(false, html, this);
mPresenter.loadData(true);
}

private void setTheme(boolean isDark) {
isChangingTheme = true;
if (isDark) {
Expand Down Expand Up @@ -428,7 +418,7 @@ public void onHeaderClick(HomeHeaderBean.HeaderDataBean bean) {
//===========================================================
case HomeHeaderBean.TYPE_DMFL_MALIMALI_TAG:
bundle.putString("homeParam", Api.MALIMALI_TAG_DEFAULT);
bundle.putString("title", "全部");
bundle.putString("title", "全部类型");
startActivity(new Intent(this, MaliTagActivity.class).putExtras(bundle));
break;
case HomeHeaderBean.TYPE_DMFL_MALIMALI_JAPAN:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@

public interface HomeContract {
interface Model {
void getData(boolean isWeek, String mailiHtml, LoadDataCallback callback);

void getMaliWeek(LoadDataCallback callback);
void getData(boolean isWeek, LoadDataCallback callback);
}

interface View extends BaseView {
Expand All @@ -21,8 +19,6 @@ interface View extends BaseView {
void showHomeLoadSuccess(List<HomeBean> beans);

void showUpdateInfoSuccess(List<AnimeUpdateInfoBean> animeUpdateInfoBeans);

void showMaliWeekInfoSuccess(String html);
}

interface LoadDataCallback extends BaseLoadDataCallback {
Expand All @@ -31,7 +27,5 @@ interface LoadDataCallback extends BaseLoadDataCallback {
void homeSuccess(List<HomeBean> beans);

void updateInfoSuccess(List<AnimeUpdateInfoBean> animeUpdateInfoBeans);

void maliWeekInfoSuccess(String html);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,14 @@
public class HomeModel extends BaseModel implements HomeContract.Model {

@Override
public void getData(boolean isWeek, String mailiHtml, HomeContract.LoadDataCallback callback) {
public void getData(boolean isWeek, HomeContract.LoadDataCallback callback) {
if (isImomoe())
parserImomoe(isWeek, mailiHtml, callback);
parserImomoe(isWeek, callback);
else
parserYhdm(isWeek, mailiHtml, callback, "");
parserYhdm(isWeek, callback, "");
}

@Override
public void getMaliWeek(HomeContract.LoadDataCallback callback) {
getJapanWeekData(callback);
}

private void parserYhdm(boolean isWeek, String mailiHtml, HomeContract.LoadDataCallback callback, String RedirectedStr) {
private void parserYhdm(boolean isWeek, HomeContract.LoadDataCallback callback, String RedirectedStr) {
callback.log(Sakura.DOMAIN + RedirectedStr);
new HttpGet(Sakura.DOMAIN + RedirectedStr, new Callback() {
@Override
Expand All @@ -46,10 +41,10 @@ public void onResponse(Call call, Response response) {
try {
String source = getBody(response);
if (YhdmJsoupUtils.hasRedirected(source)) // 如果有重定向
parserYhdm(isWeek, mailiHtml, callback, YhdmJsoupUtils.getRedirectedStr(source));
parserYhdm(isWeek, callback, YhdmJsoupUtils.getRedirectedStr(source));
else {
if (YhdmJsoupUtils.hasRefresh(source)) // 如果有定时跳转
parserYhdm(isWeek, mailiHtml, callback, "");
parserYhdm(isWeek, callback, "");
else {
if (isWeek) {
LinkedHashMap map = YhdmJsoupUtils.getHomeData(source);
Expand Down Expand Up @@ -78,7 +73,7 @@ public void onResponse(Call call, Response response) {
});
}

private void parserImomoe(boolean isWeek, String mailiHtml, HomeContract.LoadDataCallback callback) {
private void parserImomoe(boolean isWeek, HomeContract.LoadDataCallback callback) {
callback.log(Sakura.DOMAIN);
new HttpGet(Sakura.DOMAIN, new Callback() {
@Override
Expand All @@ -91,7 +86,7 @@ public void onResponse(Call call, Response response) {
try {
String source = getBody(response);
if (isWeek) {
LinkedHashMap map = ImomoeJsoupUtils.getHomeData(mailiHtml, source);
LinkedHashMap map = ImomoeJsoupUtils.getHomeData(source);
if ((boolean) map.get("success"))
callback.success(map);
else
Expand All @@ -111,25 +106,4 @@ public void onResponse(Call call, Response response) {
}
});
}

private void getJapanWeekData(HomeContract.LoadDataCallback callback) {
new HttpGet(Sakura.DOMAIN + Api.MALIMALI_JAPAN_WEEK, new Callback() {

@Override
public void onFailure(Call call, IOException e) {
callback.maliWeekInfoSuccess("");
}

@Override
public void onResponse(Call call, Response response) {
try {
String japanSource = getBody(response);
callback.maliWeekInfoSuccess(japanSource);
} catch (Exception e) {
e.printStackTrace();
callback.maliWeekInfoSuccess("");
}
}
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@

public class HomePresenter extends Presenter<HomeContract.View> implements BasePresenter, HomeContract.LoadDataCallback {
private boolean isWeek;
private String maliHtml;
private HomeContract.View view;
private HomeModel model;

public HomePresenter(boolean isWeek, String maliHtml, HomeContract.View view) {
public HomePresenter(boolean isWeek, HomeContract.View view) {
super(view);
this.isWeek = isWeek;
this.maliHtml = maliHtml;
this.view = view;
model = new HomeModel();
}
Expand All @@ -26,12 +24,7 @@ public HomePresenter(boolean isWeek, String maliHtml, HomeContract.View view) {
public void loadData(boolean isMain) {
if (isMain)
view.showLoadingView();
model.getData(isWeek, maliHtml, this);
}

public void loadMailiHtmlData() {
view.showLoadingView();
model.getMaliWeek(this);
model.getData(isWeek, this);
}

@Override
Expand All @@ -49,11 +42,6 @@ public void updateInfoSuccess(List<AnimeUpdateInfoBean> animeUpdateInfoBeans) {
view.showUpdateInfoSuccess(animeUpdateInfoBeans);
}

@Override
public void maliWeekInfoSuccess(String html) {
view.showMaliWeekInfoSuccess(html);
}

@Override
public void error(String msg) {
view.showLoadErrorView(msg);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ public void getVideoEmpty() {
public void getVideoError() {
getActivity().runOnUiThread(() -> {
// application.showErrorToastMsg(Utils.getString(R.string.error_700));
CustomToast.showToast(getActivity(), Utils.getString(R.string.error_700), CustomToast.ERROR);
CustomToast.showToast(getActivity(), Utils.getString(R.string.loading_video__failed), CustomToast.ERROR);
});
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package my.project.sakuraproject.main.player;

import android.content.DialogInterface;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Toast;

import org.greenrobot.eventbus.EventBus;

Expand Down Expand Up @@ -72,6 +74,18 @@ protected void snifferVideo() {
if (webUrl.contains("jx.618g.com")) {
cancelDialog();
VideoUtils.openDefaultWebview(this, webUrl);
} else if (webUrl.contains("html")) {
VideoUtils.showParseAlert(this, (dialog, index) -> {
dialog.dismiss();
url = String.format(Api.PARSE_INTERFACE[index], url);
if (index == Api.PARSE_INTERFACE.length -1) {
VideoUtils.openDefaultWebview(this, url);
this.finish();
} else {
SniffingUtil.get().activity(this).referer(url).callback(this).url(url).start();
Toast.makeText(this, Utils.getString(R.string.select_parse_interface_msg), Toast.LENGTH_LONG).show();
}
});
} else {
url = String.format(Api.PARSE_API, url);
SniffingUtil.get().activity(this).referer(url).callback(this).url(url).start();
Expand Down
Loading

0 comments on commit 40a4a07

Please sign in to comment.