tecuts commited on
Commit
758ae47
·
verified ·
1 Parent(s): c714721

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -116,7 +116,9 @@ async def yt_audio(url: str):
116
  try:
117
  # 设置请求头
118
  headers = {
119
- "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.2 Safari/605.1.15"
 
 
120
  }
121
 
122
  # 发送请求
@@ -128,6 +130,7 @@ async def yt_audio(url: str):
128
 
129
  # 查找匹配项
130
  match = re.search(pattern, response.text)
 
131
 
132
  if match:
133
  # 提取匹配到的JSON数据
 
116
  try:
117
  # 设置请求头
118
  headers = {
119
+ "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.2 Safari/605.1.15"
120
+ "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
121
+ "Referer": "https://www.youtube.com/"
122
  }
123
 
124
  # 发送请求
 
130
 
131
  # 查找匹配项
132
  match = re.search(pattern, response.text)
133
+ logging.info(response.text)
134
 
135
  if match:
136
  # 提取匹配到的JSON数据