require "import" import "android.app.*" import "android.os.*" import "android.widget.*" import "android.view.*" --import "layout" activity.setTheme(android.R.style.Theme_Material_Light_NoActionBar) --activity.setContentView(loadlayout(layout)) --主题 --背景白色无标题栏 --activity.setTheme(android.R.style.Theme_DeviceDefault_Light_NoActionBar)--背景白色无标题栏 import "android.view.WindowManager" import "android.graphics.drawable.ColorDrawable" --沉浸栏 activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS).setStatusBarColor(0xff21a675);----颜色0xFF4C8DAD --底部导航栏 import "android.graphics.Color" --activity.getWindow().setNavigationBarColor(Color.parseColor("#ff21a675")) activity.getWindow().setNavigationBarColor(0xff21a675); layout= { LinearLayout,--线性布局 orientation='vertical',--方向 layout_width='fill',--宽度 Focusable=true; FocusableInTouchMode=true;--禁止弹出输入法 { LinearLayout,--线性布局 orientation='horizontal',--方向 layout_width='fill',--宽度 layout_height='56dp',--高度 background='#ff21a675',--背景颜色或图片路径 { CardView;--卡片控件 layout_margin='5dp';--边距 layout_gravity='center';--重力 --左:left 右:right 中:center 顶:top 底:bottom elevation='1dp';--阴影 layout_width='fill';--宽度 layout_height='38dp';--高度 CardBackgroundColor='#FCF7FF';--颜色 radius='5dp';--圆角 { EditText,--编辑框控件 layout_width="fill",--布局宽度 layout_height="fill",--布局高度 layout_marginLeft='10dp';--左距 hint="搜索电影、电视剧、综艺、动漫",--编辑框内容为空时提示 padding="6dp",--填充边距 textSize="15sp",--文本大小 imeOptions="actionSearch",--搜索 singleLine=true,--禁止换行输入 background='#00FFFFFF',--背景颜色或图片路径 id="搜索编辑框",--控件ID }; }; }; { LinearLayout,--线性布局 orientation='vertical',--方向 layout_width='fill',--宽度 layout_height='fill',--高度 gravity='center';--重力属性 --visibility=0,--不可视4--隐藏8--显示0 id="shuaxin"; --id="加载中"; { ProgressBar;--进度条 layout_width='33dp';--进度条宽度 layout_height='33dp';--进度条高度 --小号风格 -- style='?android:attr/progressBarStyleSmall'; }; { TextView;--文本控件 gravity='center';--重力 --左:left 右:right 中:center 顶:top 底:bottom layout_width='fill';--宽度 --layout_height='fill';--高度 textColor='#036E29';--文字颜色 text='正在加载中,请等待...?';--显示文字 textSize='12dp';--文字大小 }; }; { PullingLayout;--下拉刷新 PullUpEnabled=true;--上拉刷新 -- PullDownEnabled=true;--下拉刷新 stateColor="#069928",--设置颜色 id="刷新"; { GridView,--网格视图 numColumns=2,--单排显示数 layout_width="fill",--宽度 layout_height="wrap",--高度 VerticalScrollBarEnabled=false, --OverScrollMode=2,--线条 id="list"; }; }; }; activity.setContentView(loadlayout(layout))--布局视图 适配器布局= { LinearLayout,--线性布局 orientation='vertical',--方向 layout_width='fill',--宽度 layout_height='wrap',--高度 --background='#00FFFFFF',--背景颜色或图片路径 { CardView;--卡片控件 layout_margin='4dp';--边距 layout_gravity='center';--重力 --左:left 右:right 中:center 顶:top 底:bottom elevation='2dp';--阴影 layout_width='fill';--宽度 layout_height='wrap';--高度 CardBackgroundColor='#ffffffff';--颜色 radius='3dp';--圆角 { LinearLayout,--线性布局 orientation='vertical',--方向 layout_width='fill',--宽度 layout_height='fill',--高度 -- gravity='center|top';--重力 { ImageView;--图片控件 src='';--图片路径 layout_width='fill';--宽度 layout_height='100dp';--高度 scaleType='fitXY';--图片显示类型 id="tupian"; }, { TextView;--文本控件 gravity='center';--重力 -- style="?android:attr/windowTitleStyle";--文本样式 layout_width='fill';--宽度 layout_height='36dp';--高度 textColor='#333333';--文字颜色 text='标题';--显示文字 textSize='14dp';--文字大小 padding="4dp",--填充边距 lines="1",--文本显示行 id="wen1"; }; { TextView,--文本控件 visibility=8,--控件能见度--不可视:4--隐藏:8--显示:0 id="wen2", }, { TextView,--文本控件 visibility=8,--控件能见度--不可视:4--隐藏:8--显示:0 id="tup3", }, }, } } data={} adpp=LuaAdapter(activity,data,适配器布局) list.Adapter=adpp 页码=1 function 搜索引擎(页码) 网页="https://gimytv.app/search/"..搜索编辑框.text.."----------"..页码.."---.html" Http.get(网页,function(连接状态,网页源码) if 连接状态==200 then--判断网络连接状态 local 范围=网页源码:match('
(.-)') --(.-)
') for v,in 范围:gmatch('') do 取名称=tostring(v:match([[title="(.-)"]])) 取网址=tostring(v:match([[href="(.-)"]])) 取图片=tostring(v:match([[data%-original="(.-)"]])) 取蓝光=tostring(v:match([[match('text%-right">(.-)]])) adpp.add({ tupian=取图片,--图片 wen1=取名称,--标题 tup3=取图片,--图片 wen2="https://gimytv.app"..取网址--:gsub("/voddetail/",""):gsub(".html","") }) end if 连接状态 ~= -1 then shuaxin.setVisibility(View.GONE)--控件隐藏 end else print("加载中失败") end end) end 搜索引擎(页码) --输入栏搜索页面内容 import "java.awt.event.*" 搜索编辑框.setOnKeyListener({ onKey=function(v,keyCode,event) if (KeyEvent.KEYCODE_ENTER == keyCode and KeyEvent.ACTION_DOWN == event.getAction()) then if 搜索编辑框.text=="" then print("搜索不能为空..") else adpp.clear()--清空适配器 搜索引擎(1)--加载第一页 print("正在搜索\""..搜索编辑框.Text.."\"请稍候...") end end end}) 刷新.onLoadMore=function(v)--上拉加载事件 task(500,function()--延时2秒 v.loadmoreFinish(0) 页码=页码+1 搜索引擎(页码) end) end list.onItemClick=function(p,v,i,s) --列表项目被单击 local 标题=v.Tag.wen1.text local 链接=v.Tag.wen2.text local 图片=v.Tag.tup3.text --print(标题) layouty= { LinearLayout,--线性布局 orientation='vertical',--方向 layout_width='fill',--宽度 { CardView;--卡片控件 layout_margin='8dp';--边距 layout_gravity='center';--重力 --左:left 右:right 中:center 顶:top 底:bottom elevation='1dp';--阴影 layout_width='fill';--宽度 layout_height='100%w';--高度 CardBackgroundColor='#ffffffff';--颜色 radius='8dp';--圆角 { LinearLayout,--线性布局 orientation='vertical',--方向 layout_width='fill',--宽度 padding="10dp",--填充边距 { LinearLayout,--线性布局 orientation='horizontal',--方向 layout_width='fill',--宽度 layout_height='44dp',--高度 gravity='center|left';--重力 { TextView;--文本控件 textColor='#eb000000';--文字颜色 layout_marginLeft='5dp';--左距 text='选集列表';--显示文字 textSize='15dp';--文字大小 }; { TextView;--文本控件 layout_marginLeft='18dp';--左距 textColor='#E74F22';--文字颜色 text=标题;--显示文字 textSize='15dp';--文字大小 style="?android:attr/windowTitleStyle";--文本样式 }; }; { LuaWebView;--浏览器控件 layout_width='fill';--宽度 layout_height='fill';--高度 Visibility="8";--隐藏控件 id="webView2"; }; { GridView,--网格视图 numColumns=3,--单排显示数 layout_width="fill",--宽度 layout_height="wrap",--高度 VerticalScrollBarEnabled=false, --OverScrollMode=2,--线条 id="listqq"; }; }; }; }; bali= { LinearLayout,--线性布局 orientation='vertical',--方向 layout_width='fill',--宽度 layout_height='wrap',--高度 background='#00FFFFFF',--背景颜色或图片路径 { CardView;--卡片控件 layout_margin='5dp';--边距 layout_gravity='center';--重力 --左:left 右:right 中:center 顶:top 底:bottom elevation='1dp';--阴影 layout_weight='1';--剩余属性 layout_width='fill';--宽度 layout_height='33dp';--高度 CardBackgroundColor='#189E65';--颜色 radius='3dp';--圆角 { TextView;--文本控件 gravity='center';--重力 --左:left 右:right 中:center 顶:top 底:bottom layout_width='fill';--宽度 layout_height='fill';--高度 textColor='#ffffffff';--文字颜色 text='选集';--显示文字 -- lines="1",--文本显示行 textSize='14dp';--文字大小 id="xuanj"; }; { TextView;--文本控件 visibility=8,--不可视4--隐藏8--显示0 text='播放';--显示文字 id="bofang" }; }; }; --activity.setContentView(loadlayout(layouty))--布局视图 xxx=AlertDialog.Builder(this) xxx.setView(loadlayout(layouty)) --xxx.setCancelable(false)--禁用返回键 xxx=xxx.show() --背景透明 import "android.graphics.drawable.ColorDrawable" xxx.getWindow().setBackgroundDrawable(ColorDrawable(0x00000000)) dataka={} adpap=LuaAdapter(activity,dataka,bali) listqq.Adapter=adpap --网站链接="http://www.4kdyw.cn/vodplay/128855-1-1.html" Http.get(链接,nil,function(a,b) if a==200 then local 过滤=b:match('
(.-)') -- 过滤=b:match('在线观看(.-)相关影视') -- print(b) for k,v,in 过滤:gmatch('') do 播放链接=k:match('href="(.-)"') 选集=k:match('html">(.-)') -- print("https://gimytv.app"..播放链接) adpap.add{ xuanj=选集, bofang="https://gimytv.app"..播放链接 } end end end) listqq.onItemClick=function(p,v,i,s) --列表项目被单击 local 标题url=v.Tag.xuanj.text local 链接url=v.Tag.bofang.text webView2.loadUrl(链接url) webView2.setWebViewClient{ onLoadResource=function(view,url) if (url:find'.mp4') or (url:find'.m3u8') then webView2.loadUrl("about:blank") webView2.stopLoading() -- activity.newActivity("bof",android.R.anim.fade_in,android.R.anim.fade_out,{标题,图片,url,视频链接}) xxx.dismiss()--关闭对话框 end end} end --[[ listqq.onItemClick=function(p,v,i,s) --列表项目被单击 local 标题url=v.Tag.xuanj.text local 链接url=v.Tag.bofang.text --解析地址+当前网页 webView2.loadUrl(链接url) --设置禁止自动播放视频 webView2.getSettings().setMediaPlaybackRequiresUserGesture(true); webView2.setWebViewClient{ onLoadResource=function(view,url) if (url:find'://qq.adinisp.com(.-)/parse_js.php') or (url:find'://(.-).l.qq.com/') or (url:find'://(.-)51.la/') or (url:find'://(.-)cnzz.com/') or (url:find'://(.-)/kvcollect') or (url:find'://(.-)/js.php') or (url:find'://(.-)/c.php') or (url:find'://(.-)/v.php') then else if (url:find'://(.-).mp4') or (url:find'://(.-).m3u8') and (webView2.getUrl()~="about:blank") then 视频链接=url :gsub("(.+)?url=","") -- activity.newActivity("bof",android.R.anim.fade_in,android.R.anim.fade_out,{标题,图片,url,视频链接}) end end xxx.dismiss()--关闭对话框 end} end ]] end 参数=0 function onKeyDown(code,event) if string.find(tostring(event),"KEYCODE_BACK") ~= nil then if 参数+2 > tonumber(os.time()) then activity.finish() else Toast.makeText(activity,"再按一次返回键退出" , Toast.LENGTH_SHORT ) .show() 参数=tonumber(os.time()) end return true end end