Skip to content
This repository was archived by the owner on May 14, 2025. It is now read-only.

Commit 962e0a9

Browse files
authored
Merge pull request #201 from AirportR/dev
🐛 Fix netflix.py
2 parents cc8a301 + 3e7e322 commit 962e0a9

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

addons/builtin/netflix.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import re
12
import ssl
23

34
import asyncio
@@ -37,9 +38,13 @@ async def fetch_netflix(collector, session: aiohttp.ClientSession, flag=1, proxy
3738
if res.status == 200: # 解锁非自制
3839
text = await res.text()
3940
try:
40-
locate = text.find("preferredLocale") # 定位到关键标签
41-
if locate > 0:
42-
region = text[locate + 29:locate + 31]
41+
# 正则表达式模式
42+
pattern = r'"country":"([^"]+)"'
43+
44+
# 匹配并提取国家名称
45+
match = re.search(pattern, text)
46+
if match:
47+
region = match.group(1)
4348
collector.info['netflix'] = f"解锁({region})"
4449
else:
4550
region = "未知"

0 commit comments

Comments
 (0)