Skip to content
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

_ #19

Merged
merged 4 commits into from
Nov 18, 2024
Merged

_ #19

merged 4 commits into from
Nov 18, 2024

Conversation

xtsea
Copy link
Contributor

@xtsea xtsea commented Nov 18, 2024

Summary by Sourcery

Enhancements:

  • Refactor API endpoint construction by introducing a helper method 'api_akenoai' to streamline URL creation across multiple methods.

Copy link

sourcery-ai bot commented Nov 18, 2024

Reviewer's Guide by Sourcery

This PR refactors the AkenoPlus class by introducing a new helper method api_akenoai to construct API endpoint URLs and updates all API endpoint calls to use this method. It also adds a new Pinterest endpoint and fixes some minor issues in existing methods.

Updated class diagram for AkenoPlus

classDiagram
    class AkenoPlus {
        - key
        - api_endpoint: str
        - headers: dict
        + AkenoPlus(key, api_endpoint)
        + api_akenoai(method)
        + set_key(new_key: str)
        + clean(file_path: str)
        + terabox(link)
        + terabox_v2(link)
        + chatgpt_old(query)
        + chatgpt_mode_web(query, **params)
        + sites_torrens_all()
        + search_for_torrents(**params)
        + get_torrent_from_url(**params)
        + get_recent(**params)
        + get_category(**params)
        + paal_see(files_open, **params)
        + remini_enhancer(files_open)
        + paal_text_to_image(**params)
        + google_video_to_text(files_open, **params)
        + google_image_to_text(files_open, **params)
        + google_audio_to_text(files_open, **params)
        + blackbox(**payload)
        + hentai()
        + fbdown(link)
        + pinterest(**params)
        + igdl(version, **params)
        + fdownloader(**params)
        + capcut(link)
        + add_ipblock(ip)
    }
Loading

File-Level Changes

Change Details Files
Introduced a new helper method for API endpoint URL construction
  • Added api_akenoai method to centralize API endpoint URL construction
  • Refactored all existing API endpoint calls to use the new helper method
akenoai/akeno.py
Added new Pinterest API endpoint integration
  • Implemented new pinterest method with support for v2 endpoint
akenoai/akeno.py
Fixed bugs in existing methods
  • Removed unused 'params' variable in blackbox method
  • Fixed URL variable usage in capcut method
akenoai/akeno.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @xtsea - I've reviewed your changes - here's some feedback:

Overall Comments:

  • The fdownloader method still uses string concatenation instead of the new api_akenoai() helper method
  • In the capcut method, the url variable is used but not properly defined using api_akenoai()
Here's what I looked at during the review
  • 🟡 General issues: 2 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

akenoai/akeno.py Outdated
@@ -32,6 +33,9 @@ def __init__(self, key=..., api_endpoint: str = "https://private-akeno.randydev.
self.api_endpoint = api_endpoint
self.headers = {"x-akeno-key": str(self.key)}

def api_akenoai(self, method=None):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: The method should validate the method parameter to handle None case gracefully

Consider adding validation to prevent appending 'None' to the URL when method is None

    def api_akenoai(self, method):
        if not method:
            raise ValueError("Method parameter cannot be None or empty")
        return f"{self.api_endpoint}/{method}"

return await response.json()

async def fdownloader(self, **params):
url = self.api_akenoai("akeno/capcut-v1")
async with aiohttp.ClientSession() as session:
async with session.get(f"{self.api_endpoint}/akeno/fdownloader", params=params, headers=self.headers) as response:
return await response.json()

async def capcut(self, link=None):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): The url variable is used but never defined using api_akenoai

@xtsea xtsea merged commit 878b81e into test Nov 18, 2024
5 checks passed
xtsea added a commit that referenced this pull request Nov 18, 2024
Merge pull request #19 from TeamKillerX/main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant