Skip to content

Commit c418c6b

Browse files
fix VEO
1 parent e84dd4d commit c418c6b

File tree

3 files changed

+31
-15
lines changed

3 files changed

+31
-15
lines changed

pyproject.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ maintainers = [{name="Commandcracker"}]
77
license = {file = "LICENSE.txt"}
88
readme = "README.md"
99
dependencies = [
10-
"textual==0.67.0", # 1.0.0
10+
"textual==0.67.0", # 3.0.1
1111
"beautifulsoup4>=4.13.3",
1212
"httpx[http2]>=0.28.1",
1313
"pypresence>=4.3.0",
1414
"packaging>=24.2",
15-
"platformdirs>=4.3.6",
15+
"platformdirs>=4.3.7",
1616
"toml>=0.10.2",
1717
"fuzzywuzzy>=0.18.0",
18-
"async_lru>=2.0.4"
19-
#"yt-dlp>=2025.1.26 ",
18+
"async_lru>=2.0.5"
19+
#"yt-dlp>=2025.3.31",
2020
#"mpv>=1.0.7",
2121
]
2222
keywords = [
@@ -49,8 +49,8 @@ classifiers = [
4949

5050
[project.optional-dependencies]
5151
speedups = [
52-
"levenshtein>=0.26.1",
53-
"orjson>=3.10.15"
52+
"levenshtein>=0.27.1",
53+
"orjson>=3.10.16"
5454
]
5555
socks = ["httpx[socks]>=0.28.1"]
5656

src/gucken/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
import warnings
22
warnings.filterwarnings('ignore', message='Using slow pure-python SequenceMatcher. Install python-Levenshtein to remove this warning')
33

4-
__version__ = "0.2.7"
4+
__version__ = "0.2.8"

src/gucken/hoster/veo.py

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,38 @@
11
from base64 import b64decode
22
from re import compile as re_compile
3+
from ..utils import json_loads
34

45
from ..networking import AsyncClient
56
from .common import DirectLink, Hoster
67

78
REDIRECT_PATTERN = re_compile("https?://[^'\"<>]+")
8-
EXTRACT_VEO_HLS_PATTERN = re_compile(r"'hls': '(?P<hls>.*)'")
99

10+
EXTRACT_VEO_HLS_PATTERN = re_compile(r"'hls': '(?P<hls>.*)'")
11+
HIDDEN_JSON_PATTERN = re_compile(r"var a168c='(?P<hidden_json>[^']+)'")
1012

1113
class VOEHoster(Hoster):
1214
async def get_direct_link(self) -> DirectLink:
1315
async with AsyncClient(verify=False) as client:
14-
response = await client.get(self.url)
15-
match = REDIRECT_PATTERN.search(response.text)
16-
link = match.group()
16+
redirect_response = await client.get(self.url)
17+
redirect_match = REDIRECT_PATTERN.search(redirect_response.text)
18+
redirect_link = redirect_match.group()
19+
20+
response = await client.get(redirect_link)
1721

18-
response2 = await client.get(link)
19-
match2 = EXTRACT_VEO_HLS_PATTERN.search(response2.text)
20-
link2 = match2.group("hls")
22+
match = HIDDEN_JSON_PATTERN.search(response.text)
23+
if match:
24+
hidden_json = b64decode(match.group("hidden_json")).decode()
25+
hidden_json = hidden_json[::-1]
26+
hidden_json = json_loads(hidden_json)
27+
hidden_json = hidden_json["source"]
28+
return DirectLink(hidden_json)
2129

22-
return DirectLink(b64decode(link2).decode())
30+
hls_match = EXTRACT_VEO_HLS_PATTERN.search(response.text)
31+
hls_link = hls_match.group("hls")
32+
hls_link = b64decode(hls_link).decode()
33+
return DirectLink(
34+
url=hls_link,
35+
# Requires "host", "origin" or "referer"
36+
# can be "bypassed" by http get once for players without headers
37+
headers = {"Referer": "https://nathanfromsubject.com/"}
38+
)

0 commit comments

Comments
 (0)