请选择 进入手机版 | 继续访问电脑版

登录  | 立即注册

游客您好!登录后享受更多精彩

查看: 1907|回复: 2

[lua教程] 【lua教程】视频嗅探

[复制链接]

444

主题

509

帖子

2051

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
2051

荣誉管理论坛元老

发表于 2021-7-1 08:44:17 来自手机 | 显示全部楼层 |阅读模式 来自:
  1. --来自代码手册) g$ E3 R9 M) N+ x  [
  2. --企鹅君Robin" |9 f& z& J( }
  3. ! }: T9 g+ V6 n' `' v- A2 o
  4. require "import") ?8 U2 Y  D) Y$ P, L
  5. import "android.app.*"
    , u$ ~  _/ j2 e. u
  6. import "android.os.*"- w9 |" g' R% V9 T' v
  7. import "android.widget.*"
    ! @' T! k$ D, C: _- j2 ^
  8. import "android.view.*"
    2 L4 X. }( t) i0 c: l3 Q; e  r
  9. layout={
    6 P  V8 H# L+ @1 V+ c
  10.   LinearLayout;) z, V" D- m. |  v( h, }( h0 t
  11.   layout_height="fill";
    - U! E" m* z. s; v
  12.   orientation="vertical";" }% I1 e2 x- [8 C! g
  13.   layout_width="fill";) I" i3 c3 p5 t. v
  14.   {
      }, e( U6 s8 P; u" o3 f' h
  15.     Button;
    7 Q2 F6 n" Z  ]9 l" x
  16.     text="点击开始嗅探";5 C) P& n7 }/ g
  17.     id="bt";9 G( e, D2 g% J$ g/ D. O  x! [
  18.     layout_gravity="center";' Y) j8 |  R) ~5 N6 z4 J5 Y
  19.   };; C7 Y9 ^9 ]+ C; _* H' }) t
  20.   {; S, d0 E2 D0 r7 d( h
  21.     LuaWebView;( t4 i% S4 s$ M2 h) Z
  22.     layout_width="match_parent";% Q7 K' B1 [4 d8 }; @( ?
  23.     id="webView2";
    ) K- m& h4 X+ W) V1 Z2 f" Y9 Z( T
  24.     layout_height="50%h";' D8 q# F5 i$ l& g- T
  25.     Visibility="2";! f9 M4 K1 J  O
  26.   };  s0 y2 {9 k+ d6 \% \1 F6 e" Y
  27.   {5 l  U( ]: [8 Z0 j
  28.     TextView;, P' t! m- A: H  [/ _- S) `8 ^  h
  29.     id="txt";7 p8 b" C0 h" w
  30.     layout_width="match_parent";
    + t: s  V0 C+ M% x$ t
  31.   };$ V4 `6 L) s( ^0 z% @# e  ?
  32.   {
    ( B) c# J7 |6 K3 P9 O6 w( C
  33.     ListView;9 V9 u4 s7 ^8 }# V7 z
  34.     id="lv";, x# N# @- v3 {9 v% [+ U9 S
  35.     layout_height="match_parent";# P; e$ j( F& S4 `3 t( M
  36.     layout_width="match_parent";/ p! q, c' Y! c( [1 g9 }" P
  37.   };5 l2 d2 u3 S# m' v8 E5 i' t( x; [
  38. };( K# e/ x3 _. V" j7 W, p3 z
  39. 9 j/ T% P4 _7 R4 _7 R

  40. 7 R+ ?+ d) N' R( ?
  41. activity.setTheme(android.R.style.Theme_DeviceDefault_Light)--设置md主题
    * T$ e' K5 R; t' a  l7 P; J- H
  42. --activity.setTheme(R.AndLua1)/ x0 b9 D, X) J& z- \  f
  43. activity.setTitle("资源嗅探")
    , A9 s, J0 a* ^2 v
  44. activity.setContentView(loadlayout(layout))% F( \' y2 s' R7 m
  45. $ P% r8 r/ O6 E" o/ x: N: {: J6 o

  46. 4 _! o5 C3 e* k) B6 X3 l; Z

  47.   C8 a1 w: s( u
  48. import "android.content.Intent"3 X* @: Z4 x$ f) x
  49. import "android.net.Uri"
    3 J0 m1 ^. O5 I
  50. 4 s- y6 V( ?( L0 Q: V
  51. --urr="https://m.iqiyi.com/v_19rre7wlpk.html"9 _, k* p# k3 a) w9 E4 ^

  52. $ u( K( E/ M+ [, a
  53. item={
    1 z8 w( z% g9 s& g. E+ K: o  Y
  54.   LinearLayout;
    % N# U1 {; U9 R# a+ _$ ?
  55.   orientation="vertical";
    , W6 X8 k+ N8 g2 T
  56.   {
    0 a3 S  L% i2 h0 {
  57.     TextView;( T1 t/ s0 g9 I- o2 h; u7 a
  58.     id="tx";2 y- G- y7 \1 p/ V
  59.     layout_width="match_parent";
    4 q3 |; t% E0 p, f5 L, ]: Z
  60.   };5 E* ?# i" X% y% b% x
  61. };" w6 x+ Q8 q& x% U' w1 H4 _1 g7 X
  62. . ^* B$ ]) d& J% Q# {1 M  v
  63. . @3 ^6 j- d' p% |
  64. data={}) M; p6 M# s# `
  65. adp=LuaAdapter(activity,data,item)1 W. G1 S* x* x' [- u* z
  66. lv.Adapter=adp
    ) H* _+ q: R+ p+ W2 M3 R

  67. % o5 t' S( E$ `( r( L# `

  68. % ?9 \* K3 S  |* e' D
  69. 4 ?& I: e6 e) Z1 b9 M1 W
  70. bt.onClick=function
    3 k, o7 l  h, ^
  71.   adp.clear()
    ( b4 [& x+ m5 @

  72. " \4 I/ t/ ?; ~
  73.   InputLayout={, X6 K/ b2 u5 U0 i
  74.     LinearLayout;
    2 J) E, x4 z' v. d5 p
  75.     orientation="vertical";! |. t* |4 A2 U+ N0 ~
  76.     Focusable=true,
    9 t( u8 G& i1 l5 k3 K* K; E4 F- v
  77.     FocusableInTouchMode=true,
    7 L3 O# k$ J9 Q8 W

  78. / F' ?/ y+ L  @6 O+ L* ^9 D1 M" }
  79. ) B. h: p1 L) M# ^+ K
  80.     {/ P- B3 w9 ]$ p, c* [' I
  81.       EditText;: a3 L+ b4 j# @8 E4 |8 s
  82.       text="http://okjx.cc/?url=https://m.v.qq.com/x/cover/z/zr5a67l333ehzu9.html";
    . l. m8 l8 H* A0 |3 {  @' w: ^! x
  83.       hint="输入需要嗅探的链接";, X, v2 K9 \. ?' @( t3 E
  84.       layout_marginTop="5dp";
    ! w7 G, c8 s) W4 s
  85.       layout_width="80%w";
    $ x( |0 f, y  d  V
  86.       layout_gravity="center",
    - Q0 D. j) b$ g4 h
  87.       id="ed1";2 O6 g: C  U, G! x
  88.     };9 E+ {) O' U$ T# r8 {6 A
  89.     {% i9 r5 k; O' j0 h, w2 y2 w! |
  90.       TextView;
    ; p0 r; F( q$ c/ c3 l) A' c
  91.       text="部分链接需要网页加载完成才能嗅探出,如视频";
    ! Q$ C+ M  X& X5 A0 |
  92.       layout_width="match_parent";
      z& x7 ~2 M) b& q" [3 O% g: J
  93.     };4 \8 c3 D8 P9 c

  94. ! E( E$ h" ], A4 I4 c
  95.   };
    5 F: z2 _& h, |  e' O: n

  96. & r/ D1 j& p, W! Y! T& J
  97.   AlertDialog.Builder(this)! {* Q( b% K7 ]( P1 k2 [1 N
  98.   .setTitle("需要嗅探的链接")
    " N" n; R( j  [: |& S7 F
  99.   .setView(loadlayout(InputLayout))
    9 Z. s0 q( f( ~9 x& Q0 ]
  100.   .setPositiveButton("确定",{onClick=function(v)+ f( l# A; g& ?
  101. $ m- Q* Y+ f, u
  102.       n=0
    & e6 `# l, [5 B# A- [3 ^3 \
  103.       webView2.loadUrl(ed1.Text)# u8 M: e2 X! |/ d9 f- Q' Y  }
  104.       webView2.setWebViewClient{4 D' h) O: L) R

  105. # h" R7 @6 A& N9 A: L! X6 ^
  106.         onLoadResource=function(view,url)
    " q1 m) v( X* D
  107.   T5 K  w* \6 @' b5 x8 L" _' j7 _+ e7 Z
  108.           if (url:find'm3u8')or (url:find'mp4') then--嗅探关键词,可自行添加
    ! o$ }' h2 H# i& L& p
  109.             -- webView2.stopLoading()
    0 \$ e8 e6 f2 O5 _$ \0 f' L3 ^
  110.             adp.add{tx=url}0 U) |: H' m* f1 n$ y7 r
  111.             n=n+1
    . X2 k* Q; S: L3 x& T6 S
  112.             txt.setText("已嗅探到"..tostring(n).."条视频链接")
    / R/ r% c- x6 n
  113.           end
    ) X0 ^! H2 Y7 b2 W' b* c
  114.         end }7 }$ y$ O9 g: d5 u7 _4 ?

  115. % K: B3 a0 U3 _/ D- {& `2 m

  116.   H! ~- Q4 o$ I! n. K
  117. - a9 o5 E6 P7 n! c9 s) C4 t
  118.     end})
    1 L" W5 `/ a0 F  P6 i
  119.   .setNegativeButton("取消",nil), x5 D5 ]! Y. n$ G- A
  120.   .show()
    ) C: V2 @" a! H
  121. , i+ u; X% }; |- |+ X
  122. ' X- S  K" E# v' K
  123. 6 e7 L6 a9 R( o' H7 l
  124. end1 f$ B+ S" i3 Z' _
  125. + u0 M# W7 c5 a: b" J

  126. + O4 J) p8 i2 f" Z$ r( t8 f0 Q; V
  127. import "android.content.Context"
    6 f5 I& x+ k, T& z; ^2 E
  128. lv.onItemClick=function(l,v,p,i)
    1 O8 [$ N+ R2 _! q. D1 W
  129.   url=v.Tag.tx.Text- Y: H4 }3 @" H$ m
  130.   activity.getSystemService(Context.CLIPBOARD_SERVICE).setText(url)- r1 ^# E$ h& O% \" ^0 p
  131.   import "android.content.Intent"
    / R5 U! k0 f* d" V% I) b) h
  132.   import "android.net.Uri"
    ; D' ~" t8 u4 r
  133.   viewIntent = Intent("android.intent.action.VIEW",Uri.parse(url))9 X& u& B5 f) p3 Z/ e
  134.   activity.startActivity(viewIntent)! N) j6 {) N0 d: U0 S. y
  135.   return true! C% f, D# |$ p4 {, R
  136. end3 x( T4 I& Z& K0 K
  137. ' O/ L4 H: `. C  o2 h+ V) S

  138. 8 r9 O3 M8 ]) C/ o: s& m" x' B3 F: Z
  139. 1 d7 ]' t1 i& K. i

  140. ; X( B" f5 R7 b4 U3 p
复制代码
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|星空社区 |网站地图

GMT+8, 2024-4-19 10:05 , Processed in 0.051761 second(s), 32 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表