Qilan2 commited on
Commit
48859e1
·
verified ·
1 Parent(s): 0f06211

Update sbx/a/app1.py

Browse files
Files changed (1) hide show
  1. sbx/a/app1.py +21 -7
sbx/a/app1.py CHANGED
@@ -214,7 +214,7 @@ ingress:
214
  with open(os.path.join(FILE_PATH, 'tunnel.yml'), 'w') as f:
215
  f.write(tunnel_yml)
216
  else:
217
- print("Use token connect to tunnel,please set the {ARGO_PORT} in cloudflare")
218
 
219
  # Execute shell command and return output
220
  def exec_cmd(command):
@@ -411,8 +411,11 @@ uuid: {UUID}"""
411
  "music.youtube.com",
412
  "github.com",
413
  "www.youtube.com",
 
414
  "youtube.com",
415
  "youtu.be",
 
 
416
  "googlevideo.com",
417
  "ytimg.com",
418
  "gstatic.com",
@@ -600,13 +603,24 @@ def send_telegram():
600
  requests.post(url, params=params)
601
  print('Telegram message sent successfully')
602
  except Exception as e:
603
- print(f'Failed to send Telegram message: {e}')
604
 
605
  # Generate links and subscription content
606
  async def generate_links(argo_domain):
607
- meta_info = subprocess.run(['curl', '-s', 'https://speed.cloudflare.com/meta'], capture_output=True, text=True)
608
- meta_info = meta_info.stdout.split('"')
609
- ISP = f"{meta_info[25]}-{meta_info[17]}".replace(' ', '_').strip()
 
 
 
 
 
 
 
 
 
 
 
610
 
611
  time.sleep(2)
612
  VMESS = {"v": "2", "ps": f"{NAME}", "add": 'time.is', "port": CFPORT, "id": UUID, "aid": "0", "scy": "none", "net": "ws", "type": "none", "host": argo_domain, "path": "/vmess-argo?ed=2560", "tls": "tls", "sni": argo_domain, "alpn": "", "fp": "chrome"}
@@ -670,9 +684,9 @@ trojan://{UUID}@cloudflare.cdnjson.com:{CFPORT}?security=tls&sni={argo_domain}&f
670
  with open(os.path.join(FILE_PATH, 'sub.txt'), 'w', encoding='utf-8') as sub_file:
671
  sub_file.write(sub_txt)
672
 
673
- print(sub_txt)
674
 
675
- print(f"{FILE_PATH}/sub.txt saved successfully")
676
 
677
  # Additional actions
678
  send_telegram()
 
214
  with open(os.path.join(FILE_PATH, 'tunnel.yml'), 'w') as f:
215
  f.write(tunnel_yml)
216
  else:
217
+ print("Use token connect to ")
218
 
219
  # Execute shell command and return output
220
  def exec_cmd(command):
 
411
  "music.youtube.com",
412
  "github.com",
413
  "www.youtube.com",
414
+ "youtube.googleapis.com",
415
  "youtube.com",
416
  "youtu.be",
417
+ "yt3.ggpht.com",
418
+ "youtubei.googleapis.com",
419
  "googlevideo.com",
420
  "ytimg.com",
421
  "gstatic.com",
 
603
  requests.post(url, params=params)
604
  print('Telegram message sent successfully')
605
  except Exception as e:
606
+ print(f'Failed to send Telegram message: ')
607
 
608
  # Generate links and subscription content
609
  async def generate_links(argo_domain):
610
+ # 使用 requests subprocess 获取数据
611
+ try:
612
+ response = requests.get('https://speed.cloudflare.com/meta', timeout=5)
613
+ if response.status_code == 200:
614
+ data = response.json()
615
+ # 从 JSON 字典中安全提取字段,如果不存在则使用默认值
616
+ asn_organization = data.get('asOrganization', 'Unknown-ISP')
617
+ city = data.get('city', 'Unknown-City')
618
+ ISP = f"{asn_organization}-{city}".replace(' ', '_').strip()
619
+ else:
620
+ ISP = "Unknown_ISP"
621
+ except Exception as e:
622
+ print(f"Failed to fetch ISP info: ")
623
+ ISP = "Default_ISP"
624
 
625
  time.sleep(2)
626
  VMESS = {"v": "2", "ps": f"{NAME}", "add": 'time.is', "port": CFPORT, "id": UUID, "aid": "0", "scy": "none", "net": "ws", "type": "none", "host": argo_domain, "path": "/vmess-argo?ed=2560", "tls": "tls", "sni": argo_domain, "alpn": "", "fp": "chrome"}
 
684
  with open(os.path.join(FILE_PATH, 'sub.txt'), 'w', encoding='utf-8') as sub_file:
685
  sub_file.write(sub_txt)
686
 
687
+ # print(sub_txt)
688
 
689
+ # print(f"{FILE_PATH}/sub.txt saved successfully")
690
 
691
  # Additional actions
692
  send_telegram()