Skip to content

Commit

Permalink
🐛 Fix netflix.py
Browse files Browse the repository at this point in the history
  • Loading branch information
AirportR committed Nov 27, 2024
1 parent b709e9d commit 3e7e322
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions addons/builtin/netflix.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import re
import ssl

import asyncio
Expand Down Expand Up @@ -37,9 +38,13 @@ async def fetch_netflix(collector, session: aiohttp.ClientSession, flag=1, proxy
if res.status == 200: # 解锁非自制
text = await res.text()
try:
locate = text.find("preferredLocale") # 定位到关键标签
if locate > 0:
region = text[locate + 29:locate + 31]
# 正则表达式模式
pattern = r'"country":"([^"]+)"'

# 匹配并提取国家名称
match = re.search(pattern, text)
if match:
region = match.group(1)
collector.info['netflix'] = f"解锁({region})"
else:
region = "未知"
Expand Down

0 comments on commit 3e7e322

Please sign in to comment.