You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

133 lines
4.5 KiB

8 months ago
  1. package com.github.catvod.debug;
  2. import android.app.Activity;
  3. import android.os.Bundle;
  4. import android.text.Editable;
  5. import android.widget.Button;
  6. import android.widget.EditText;
  7. import android.widget.Toast;
  8. import com.github.catvod.R;
  9. import com.github.catvod.crawler.Spider;
  10. import com.github.catvod.spider.CaoLiu;
  11. import com.github.catvod.spider.Cg51;
  12. import com.github.catvod.spider.DaGongRen;
  13. import com.github.catvod.spider.Douban;
  14. import com.github.catvod.spider.Fpie2;
  15. import com.github.catvod.spider.HiPianZhiBo;
  16. import com.github.catvod.spider.HkTv;
  17. import com.github.catvod.spider.IQIYI;
  18. import com.github.catvod.spider.Ikanbot;
  19. import com.github.catvod.spider.Init;
  20. import com.github.catvod.spider.J91;
  21. import com.github.catvod.spider.JJAiPian;
  22. import com.github.catvod.spider.Jable;
  23. import com.github.catvod.spider.JavDb;
  24. import com.github.catvod.spider.JustLive;
  25. import com.github.catvod.spider.MGTV;
  26. import com.github.catvod.spider.MiMei;
  27. import com.github.catvod.spider.NCat;
  28. import com.github.catvod.spider.QxiTv;
  29. import com.github.catvod.spider.ROU223;
  30. import com.github.catvod.spider.RouVideo;
  31. import com.github.catvod.spider.TvDy;
  32. import com.github.catvod.spider.W55Movie;
  33. import com.github.catvod.spider.WWRR;
  34. import com.github.catvod.spider.Wogg;
  35. import com.github.catvod.spider.XMVideo;
  36. import com.github.catvod.spider.XVideos;
  37. import com.github.catvod.spider.YingTan;
  38. import com.github.catvod.spider.Zhaozy;
  39. import com.orhanobut.logger.AndroidLogAdapter;
  40. import com.orhanobut.logger.Logger;
  41. import java.util.ArrayList;
  42. import java.util.Arrays;
  43. import java.util.HashMap;
  44. import java.util.concurrent.ExecutorService;
  45. import java.util.concurrent.Executors;
  46. public class MainActivity extends Activity {
  47. private ExecutorService executor;
  48. private Spider spider;
  49. @Override
  50. protected void onCreate(Bundle savedInstanceState) {
  51. super.onCreate(savedInstanceState);
  52. setContentView(R.layout.activity_main);
  53. Button homeContent = findViewById(R.id.homeContent);
  54. Button homeVideoContent = findViewById(R.id.homeVideoContent);
  55. Button categoryContent = findViewById(R.id.categoryContent);
  56. Button detailContent = findViewById(R.id.detailContent);
  57. Button playerContent = findViewById(R.id.playerContent);
  58. Button searchContent = findViewById(R.id.searchContent);
  59. homeContent.setOnClickListener(view -> executor.execute(this::homeContent));
  60. homeVideoContent.setOnClickListener(view -> executor.execute(this::homeVideoContent));
  61. categoryContent.setOnClickListener(view -> executor.execute(this::categoryContent));
  62. detailContent.setOnClickListener(view -> executor.execute(this::detailContent));
  63. playerContent.setOnClickListener(view -> executor.execute(this::playerContent));
  64. searchContent.setOnClickListener(view -> executor.execute(this::searchContent));
  65. Logger.addLogAdapter(new AndroidLogAdapter());
  66. executor = Executors.newCachedThreadPool();
  67. executor.execute(this::initSpider);
  68. }
  69. private void initSpider() {
  70. try {
  71. Init.init(getApplicationContext());
  72. spider = new TvDy();
  73. spider.init(this, "");
  74. } catch (Throwable e) {
  75. e.printStackTrace();
  76. }
  77. }
  78. public void homeContent() {
  79. try {
  80. Logger.t("homeContent").d(spider.homeContent(true));
  81. } catch (Throwable e) {
  82. e.printStackTrace();
  83. }
  84. }
  85. public void homeVideoContent() {
  86. try {
  87. Logger.t("homeVideoContent").d(spider.homeVideoContent());
  88. } catch (Throwable e) {
  89. e.printStackTrace();
  90. }
  91. }
  92. public void categoryContent(){
  93. try {
  94. Logger.t("categoryContent").d(spider.categoryContent("4", "2", true, new HashMap<>()));
  95. } catch (Throwable e) {
  96. e.printStackTrace();
  97. }
  98. }
  99. public void detailContent() {
  100. try {
  101. Logger.t("detailContent").d(spider.detailContent(Arrays.asList("index122512.html")));
  102. } catch (Throwable e) {
  103. e.printStackTrace();
  104. }
  105. }
  106. public void playerContent() {
  107. try {
  108. Logger.t("playerContent").d(spider.playerContent("轉存原畫", "122512-1-0.html", new ArrayList<>()));
  109. } catch (Throwable e) {
  110. e.printStackTrace();
  111. }
  112. }
  113. public void searchContent() {
  114. try {
  115. Logger.t("searchContent").d(spider.searchContent("空姐", false));
  116. } catch (Throwable e) {
  117. e.printStackTrace();
  118. }
  119. }
  120. }