|
- --来自代码手册) g$ E3 R9 M) N+ x [
- --企鹅君Robin" |9 f& z& J( }
- ! }: T9 g+ V6 n' `' v- A2 o
- require "import") ?8 U2 Y D) Y$ P, L
- import "android.app.*"
, u$ ~ _/ j2 e. u - import "android.os.*"- w9 |" g' R% V9 T' v
- import "android.widget.*"
! @' T! k$ D, C: _- j2 ^ - import "android.view.*"
2 L4 X. }( t) i0 c: l3 Q; e r - layout={
6 P V8 H# L+ @1 V+ c - LinearLayout;) z, V" D- m. | v( h, }( h0 t
- layout_height="fill";
- U! E" m* z. s; v - orientation="vertical";" }% I1 e2 x- [8 C! g
- layout_width="fill";) I" i3 c3 p5 t. v
- {
}, e( U6 s8 P; u" o3 f' h - Button;
7 Q2 F6 n" Z ]9 l" x - text="点击开始嗅探";5 C) P& n7 }/ g
- id="bt";9 G( e, D2 g% J$ g/ D. O x! [
- layout_gravity="center";' Y) j8 | R) ~5 N6 z4 J5 Y
- };; C7 Y9 ^9 ]+ C; _* H' }) t
- {; S, d0 E2 D0 r7 d( h
- LuaWebView;( t4 i% S4 s$ M2 h) Z
- layout_width="match_parent";% Q7 K' B1 [4 d8 }; @( ?
- id="webView2";
) K- m& h4 X+ W) V1 Z2 f" Y9 Z( T - layout_height="50%h";' D8 q# F5 i$ l& g- T
- Visibility="2";! f9 M4 K1 J O
- }; s0 y2 {9 k+ d6 \% \1 F6 e" Y
- {5 l U( ]: [8 Z0 j
- TextView;, P' t! m- A: H [/ _- S) `8 ^ h
- id="txt";7 p8 b" C0 h" w
- layout_width="match_parent";
+ t: s V0 C+ M% x$ t - };$ V4 `6 L) s( ^0 z% @# e ?
- {
( B) c# J7 |6 K3 P9 O6 w( C - ListView;9 V9 u4 s7 ^8 }# V7 z
- id="lv";, x# N# @- v3 {9 v% [+ U9 S
- layout_height="match_parent";# P; e$ j( F& S4 `3 t( M
- layout_width="match_parent";/ p! q, c' Y! c( [1 g9 }" P
- };5 l2 d2 u3 S# m' v8 E5 i' t( x; [
- };( K# e/ x3 _. V" j7 W, p3 z
- 9 j/ T% P4 _7 R4 _7 R
7 R+ ?+ d) N' R( ?- activity.setTheme(android.R.style.Theme_DeviceDefault_Light)--设置md主题
* T$ e' K5 R; t' a l7 P; J- H - --activity.setTheme(R.AndLua1)/ x0 b9 D, X) J& z- \ f
- activity.setTitle("资源嗅探")
, A9 s, J0 a* ^2 v - activity.setContentView(loadlayout(layout))% F( \' y2 s' R7 m
- $ P% r8 r/ O6 E" o/ x: N: {: J6 o
4 _! o5 C3 e* k) B6 X3 l; Z
C8 a1 w: s( u- import "android.content.Intent"3 X* @: Z4 x$ f) x
- import "android.net.Uri"
3 J0 m1 ^. O5 I - 4 s- y6 V( ?( L0 Q: V
- --urr="https://m.iqiyi.com/v_19rre7wlpk.html"9 _, k* p# k3 a) w9 E4 ^
$ u( K( E/ M+ [, a- item={
1 z8 w( z% g9 s& g. E+ K: o Y - LinearLayout;
% N# U1 {; U9 R# a+ _$ ? - orientation="vertical";
, W6 X8 k+ N8 g2 T - {
0 a3 S L% i2 h0 { - TextView;( T1 t/ s0 g9 I- o2 h; u7 a
- id="tx";2 y- G- y7 \1 p/ V
- layout_width="match_parent";
4 q3 |; t% E0 p, f5 L, ]: Z - };5 E* ?# i" X% y% b% x
- };" w6 x+ Q8 q& x% U' w1 H4 _1 g7 X
- . ^* B$ ]) d& J% Q# {1 M v
- . @3 ^6 j- d' p% |
- data={}) M; p6 M# s# `
- adp=LuaAdapter(activity,data,item)1 W. G1 S* x* x' [- u* z
- lv.Adapter=adp
) H* _+ q: R+ p+ W2 M3 R
% o5 t' S( E$ `( r( L# `
% ?9 \* K3 S |* e' D- 4 ?& I: e6 e) Z1 b9 M1 W
- bt.onClick=function
3 k, o7 l h, ^ - adp.clear()
( b4 [& x+ m5 @
" \4 I/ t/ ?; ~- InputLayout={, X6 K/ b2 u5 U0 i
- LinearLayout;
2 J) E, x4 z' v. d5 p - orientation="vertical";! |. t* |4 A2 U+ N0 ~
- Focusable=true,
9 t( u8 G& i1 l5 k3 K* K; E4 F- v - FocusableInTouchMode=true,
7 L3 O# k$ J9 Q8 W
/ F' ?/ y+ L @6 O+ L* ^9 D1 M" }- ) B. h: p1 L) M# ^+ K
- {/ P- B3 w9 ]$ p, c* [' I
- EditText;: a3 L+ b4 j# @8 E4 |8 s
- text="http://okjx.cc/?url=https://m.v.qq.com/x/cover/z/zr5a67l333ehzu9.html";
. l. m8 l8 H* A0 |3 { @' w: ^! x - hint="输入需要嗅探的链接";, X, v2 K9 \. ?' @( t3 E
- layout_marginTop="5dp";
! w7 G, c8 s) W4 s - layout_width="80%w";
$ x( |0 f, y d V - layout_gravity="center",
- Q0 D. j) b$ g4 h - id="ed1";2 O6 g: C U, G! x
- };9 E+ {) O' U$ T# r8 {6 A
- {% i9 r5 k; O' j0 h, w2 y2 w! |
- TextView;
; p0 r; F( q$ c/ c3 l) A' c - text="部分链接需要网页加载完成才能嗅探出,如视频";
! Q$ C+ M X& X5 A0 | - layout_width="match_parent";
z& x7 ~2 M) b& q" [3 O% g: J - };4 \8 c3 D8 P9 c
! E( E$ h" ], A4 I4 c- };
5 F: z2 _& h, | e' O: n
& r/ D1 j& p, W! Y! T& J- AlertDialog.Builder(this)! {* Q( b% K7 ]( P1 k2 [1 N
- .setTitle("需要嗅探的链接")
" N" n; R( j [: |& S7 F - .setView(loadlayout(InputLayout))
9 Z. s0 q( f( ~9 x& Q0 ] - .setPositiveButton("确定",{onClick=function(v)+ f( l# A; g& ?
- $ m- Q* Y+ f, u
- n=0
& e6 `# l, [5 B# A- [3 ^3 \ - webView2.loadUrl(ed1.Text)# u8 M: e2 X! |/ d9 f- Q' Y }
- webView2.setWebViewClient{4 D' h) O: L) R
# h" R7 @6 A& N9 A: L! X6 ^- onLoadResource=function(view,url)
" q1 m) v( X* D - T5 K w* \6 @' b5 x8 L" _' j7 _+ e7 Z
- if (url:find'm3u8')or (url:find'mp4') then--嗅探关键词,可自行添加
! o$ }' h2 H# i& L& p - -- webView2.stopLoading()
0 \$ e8 e6 f2 O5 _$ \0 f' L3 ^ - adp.add{tx=url}0 U) |: H' m* f1 n$ y7 r
- n=n+1
. X2 k* Q; S: L3 x& T6 S - txt.setText("已嗅探到"..tostring(n).."条视频链接")
/ R/ r% c- x6 n - end
) X0 ^! H2 Y7 b2 W' b* c - end }7 }$ y$ O9 g: d5 u7 _4 ?
% K: B3 a0 U3 _/ D- {& `2 m
H! ~- Q4 o$ I! n. K- - a9 o5 E6 P7 n! c9 s) C4 t
- end})
1 L" W5 `/ a0 F P6 i - .setNegativeButton("取消",nil), x5 D5 ]! Y. n$ G- A
- .show()
) C: V2 @" a! H - , i+ u; X% }; |- |+ X
- ' X- S K" E# v' K
- 6 e7 L6 a9 R( o' H7 l
- end1 f$ B+ S" i3 Z' _
- + u0 M# W7 c5 a: b" J
+ O4 J) p8 i2 f" Z$ r( t8 f0 Q; V- import "android.content.Context"
6 f5 I& x+ k, T& z; ^2 E - lv.onItemClick=function(l,v,p,i)
1 O8 [$ N+ R2 _! q. D1 W - url=v.Tag.tx.Text- Y: H4 }3 @" H$ m
- activity.getSystemService(Context.CLIPBOARD_SERVICE).setText(url)- r1 ^# E$ h& O% \" ^0 p
- import "android.content.Intent"
/ R5 U! k0 f* d" V% I) b) h - import "android.net.Uri"
; D' ~" t8 u4 r - viewIntent = Intent("android.intent.action.VIEW",Uri.parse(url))9 X& u& B5 f) p3 Z/ e
- activity.startActivity(viewIntent)! N) j6 {) N0 d: U0 S. y
- return true! C% f, D# |$ p4 {, R
- end3 x( T4 I& Z& K0 K
- ' O/ L4 H: `. C o2 h+ V) S
8 r9 O3 M8 ]) C/ o: s& m" x' B3 F: Z- 1 d7 ]' t1 i& K. i
; X( B" f5 R7 b4 U3 p
复制代码 |
|