-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
83b5dd7
commit b1e412b
Showing
4 changed files
with
38 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,22 @@ | ||
def speedfiles_get_direct_link() -> str: | ||
return "Speedfiles support is not implemented yet." | ||
import re | ||
import base64 | ||
|
||
SPEEDFILES_PATTERN = re.compile(r'var _0x5opu234 = "(?P<encoded_data>.*?)";') | ||
|
||
|
||
def speedfiles_get_direct_link(soup): | ||
data = str(soup) | ||
match = SPEEDFILES_PATTERN.search(data) | ||
|
||
if not match: | ||
raise ValueError("Pattern not found in the response.") | ||
|
||
encoded_data = match.group("encoded_data") | ||
decoded = base64.b64decode(encoded_data).decode() | ||
decoded = decoded.swapcase()[::-1] | ||
decoded = base64.b64decode(decoded).decode()[::-1] | ||
decoded_hex = ''.join(chr(int(decoded[i:i + 2], 16)) for i in range(0, len(decoded), 2)) | ||
shifted = ''.join(chr(ord(char) - 3) for char in decoded_hex) | ||
result = base64.b64decode(shifted.swapcase()[::-1]).decode() | ||
|
||
return result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters