bep40 commited on
Commit
a33afe8
·
verified ·
1 Parent(s): 3349c6f

Restore to version before VTV live TV slide (no comments, fixed video start, video share links)

Browse files
Files changed (1) hide show
  1. main.py +6 -19
main.py CHANGED
@@ -24,25 +24,6 @@ def _cached(key, fn):
24
  def _get(url,headers=None):
25
  h=headers or HEADERS;r=requests.get(url,headers=h,timeout=15);r.encoding="utf-8"
26
  return BeautifulSoup(r.text,"lxml")
27
-
28
- # ===== LIVE TV =====
29
- # YouTube channels that have frequent/24h live streams
30
- # Using @handle/live URL which redirects to current live stream
31
- VTV_CHANNELS = [
32
- {"id":"vtv24","name":"VTV24","desc":"Tin tức trực tiếp 24/7","yt_url":"https://www.youtube.com/@VTV24/live","logo":"https://yt3.googleusercontent.com/ytc/AIdro_nVzOer7TKHV4jNgaWy47l-qY5GhPNE_WiKpb2YPRvNdg=s176-c-k-c0x00ffffff-no-rj"},
33
- {"id":"thoisuvtv","name":"Thời Sự VTV1","desc":"Bản tin thời sự","yt_url":"https://www.youtube.com/@chuongtrinhthoisuvtv/live","logo":"https://yt3.googleusercontent.com/rSEhKBCAB9E5C1MRJkL3P0jHd2aN5O5Yh-B3VH0KqKGEu5xCPfLYiDfHhW8Y7Qk1A87W9p4F=s176-c-k-c0x00ffffff-no-rj"},
34
- {"id":"vtv3","name":"VTV3","desc":"Giải trí · Trực tiếp","yt_url":"https://www.youtube.com/@VTV3GIAITRI/live","logo":"https://yt3.googleusercontent.com/v7V2P0CqJMHYfSBF7z5P5z8QmPBFgJ2L1C9qX5zK7V9L4O5qN0LKML8rQ9rZ1k-NaUJ=s176-c-k-c0x00ffffff-no-rj"},
35
- {"id":"vtvgo","name":"VTV Go","desc":"Kênh tổng hợp VTV","yt_url":"https://www.youtube.com/@VTVGochannel/live","logo":"https://yt3.googleusercontent.com/ytc/AIdro_m5Rr5S5MnN-VNzFHqfGFpK5JHvSQYu5P1Q0TSh9g=s176-c-k-c0x00ffffff-no-rj"},
36
- {"id":"vtvthethao","name":"VTV Thể Thao","desc":"Bóng đá · Thể thao","yt_url":"https://www.youtube.com/@vtvthethao/live","logo":"https://yt3.googleusercontent.com/ytc/AIdro_nH0iOI5Y9W-UzMPfbG_zZR-O7KZXIF7dL0p5Eh1w=s176-c-k-c0x00ffffff-no-rj"},
37
- {"id":"vtcnow","name":"VTC Now","desc":"VTC tin tức","yt_url":"https://www.youtube.com/@VTCNow/live","logo":"https://yt3.googleusercontent.com/ytc/AIdro_n-nz6_JJfJZ5t5CqPfNDfOG4jA0K2Z6d8N4r4P-A=s176-c-k-c0x00ffffff-no-rj"},
38
- {"id":"vnews","name":"VNEWS - TTXVN","desc":"Thông tấn xã VN","yt_url":"https://www.youtube.com/@ABOROVNEWS/live","logo":"https://yt3.googleusercontent.com/ytc/AIdro_nBzTAvb6PfI0v0rB1qK7K-5J9a0-Vp4f0E-O2g=s176-c-k-c0x00ffffff-no-rj"},
39
- {"id":"htv7","name":"HTV7","desc":"Truyền hình TP.HCM","yt_url":"https://www.youtube.com/@HTV7/live","logo":"https://yt3.googleusercontent.com/ytc/AIdro_kxc5y-WJ1h0GlAz3x5U-xRq1Z7TU1BhWeVq3tY=s176-c-k-c0x00ffffff-no-rj"},
40
- ]
41
-
42
- @app.get("/api/livetv")
43
- def api_livetv():
44
- return JSONResponse(VTV_CHANNELS)
45
-
46
  def scrape_vne(cat_url):
47
  try:
48
  soup=_get(cat_url);arts=[]
@@ -303,6 +284,9 @@ async def video_share(url:str=Query(default=""),title:str=Query(default="VNEWS V
303
  <meta property="og:type" content="video.other">
304
  <meta property="og:site_name" content="VNEWS">
305
  <meta property="og:description" content="🎬 {decoded_title} - Xem trên VNEWS">
 
 
 
306
  </head><body style="background:#111;color:#fff;font-family:sans-serif;text-align:center;padding:40px">
307
  <p>⏳ Đang mở video...</p>
308
  {redirect_script}</body></html>''')
@@ -319,6 +303,9 @@ async def share_redirect(url:str=Query(default=""),title:str=Query(default="VNEW
319
  <meta property="og:type" content="article">
320
  <meta property="og:site_name" content="VNEWS">
321
  <meta property="og:description" content="{unquote(title)} - Đọc trên VNEWS">
 
 
 
322
  </head><body>{redirect_script}</body></html>''')
323
  @app.get("/")
324
  async def index():
 
24
  def _get(url,headers=None):
25
  h=headers or HEADERS;r=requests.get(url,headers=h,timeout=15);r.encoding="utf-8"
26
  return BeautifulSoup(r.text,"lxml")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  def scrape_vne(cat_url):
28
  try:
29
  soup=_get(cat_url);arts=[]
 
284
  <meta property="og:type" content="video.other">
285
  <meta property="og:site_name" content="VNEWS">
286
  <meta property="og:description" content="🎬 {decoded_title} - Xem trên VNEWS">
287
+ <meta name="twitter:card" content="summary_large_image">
288
+ <meta name="twitter:title" content="{decoded_title}">
289
+ <meta name="twitter:image" content="{og_image}">
290
  </head><body style="background:#111;color:#fff;font-family:sans-serif;text-align:center;padding:40px">
291
  <p>⏳ Đang mở video...</p>
292
  {redirect_script}</body></html>''')
 
303
  <meta property="og:type" content="article">
304
  <meta property="og:site_name" content="VNEWS">
305
  <meta property="og:description" content="{unquote(title)} - Đọc trên VNEWS">
306
+ <meta name="twitter:card" content="summary_large_image">
307
+ <meta name="twitter:title" content="{unquote(title)}">
308
+ <meta name="twitter:image" content="{og_image}">
309
  </head><body>{redirect_script}</body></html>''')
310
  @app.get("/")
311
  async def index():