-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed shareus.io/shrs.link #33
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Diffusion123 - I've reviewed your changes and found some issues that need to be addressed.
Blocking issues:
- Duplicate function definition detected. (link)
Here's what I looked at during the review
- 🔴 General issues: 1 blocking issue, 3 other issues
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Docstrings: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.
@@ -288,6 +288,25 @@ async def shareus(url: str) -> str: | |||
except: | |||
raise DDLException("Link Extraction Failed") | |||
|
|||
async def shareus(url: str) -> str: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (bug_risk): Duplicate function definition detected.
The function shareus
is defined twice with the same signature. This will cause the first implementation to be overwritten. Consider renaming or merging the implementations if this was intentional.
@@ -288,6 +288,25 @@ async def shareus(url: str) -> str: | |||
except: | |||
raise DDLException("Link Extraction Failed") | |||
|
|||
async def shareus(url: str) -> str: | |||
DOMAIN = f"https://api.shrslink.xyz" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (code_refinement): Consider using a constant for the DOMAIN value.
Since the DOMAIN value does not change, it would be more efficient and cleaner to define it as a constant at the module level, rather than redefining it within each function call.
DOMAIN = f"https://api.shrslink.xyz" | |
DOMAIN = "https://api.shrslink.xyz" | |
async def shareus(url: str) -> str: | |
code = url.split('/')[-1] | |
headers = { |
'Origin':'https://shareus.io', | ||
} | ||
api = f"{DOMAIN}/v?shortid={code}&initial=true&referrer=" | ||
id = rget(api, headers=headers).json()['sid'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (bug_risk): Potential issue with direct access to dictionary keys.
Directly accessing the 'sid' key could raise a KeyError if it is not present in the response. Consider using a safer access method like .get('sid')
to avoid runtime exceptions.
id = rget(api, headers=headers).json()['sid'] | |
response = rget(api, headers=headers).json() | |
id = response.get('sid') |
FZBypass/core/bypass_ddl.py
Outdated
api_2 = f"{DOMAIN}/get_link?sid={id}" | ||
res = rget(api_2, headers=headers) | ||
if res: | ||
final = res.json()['link_info']['destination'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (bug_risk): Potential nested dictionary access issue.
Similar to the previous comment, directly accessing nested keys ('link_info' and 'destination') could lead to KeyError. Using a safer method to check these keys exists before accessing them would be more robust.
final = res.json()['link_info']['destination'] | |
link_info = res.json().get('link_info') | |
if link_info: | |
final = link_info.get('destination') | |
if final: | |
return final |
@@ -288,6 +288,25 @@ async def shareus(url: str) -> str: | |||
except: | |||
raise DDLException("Link Extraction Failed") | |||
|
|||
async def shareus(url: str) -> str: | |||
DOMAIN = f"https://api.shrslink.xyz" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (code-quality): We've found these issues:
- Use named expression to simplify assignment and conditional [×2] (
use-named-expression
) - Inline variable that is immediately returned (
inline-immediately-returned-variable
) - Replace f-string with no interpolated values with string (
remove-redundant-fstring
)
No description provided.