-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfind_url.py
More file actions
29 lines (25 loc) · 884 Bytes
/
find_url.py
File metadata and controls
29 lines (25 loc) · 884 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env python3
import requests
import re
import urllib.parse
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36',
}
html = requests.get('https://www.trjvod.com/index.php/vod/play/id/163720/sid/2/nid/1.html', headers=headers).text
# 搜索各种URL模式
patterns = [
r'"url":"([^"]+)"',
r'"url"\s*:\s*"([^"]+)"',
r'url\s*=\s*"([^"]+)"',
r'url\s*:\s*"([^"]+)"',
]
for i, pattern in enumerate(patterns):
matches = re.findall(pattern, html)
print(f"模式 {i+1}: {len(matches)} 个匹配")
for match in matches:
decoded = urllib.parse.unquote(match)
print(f" 原始: {match[:100]}...")
print(f" 解码: {decoded[:100]}...")
if 'm3u8' in decoded:
print(f" *** 找到m3u8链接: {decoded}")
print()