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

#433 improved fetch results to 10 #436

Merged

Conversation

RLalor
Copy link
Contributor

@RLalor RLalor commented Jul 10, 2024

Description

added 1 line of code to increase results to 10 as requested in #433 until one of the other options is implemented.

Checklist

  • [] I have read and followed the project's contributing guidelines.
  • [] I have made necessary updates to the documentation.
    image

Summary by Sourcery

Increased the maximum number of fetch results to 10 in the YouTube search query.

Copy link

vercel bot commented Jul 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
zen-audio-player-github-io ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 10, 2024 4:37pm

Copy link
Contributor

sourcery-ai bot commented Jul 10, 2024

Reviewer's Guide by Sourcery

This pull request addresses issue #433 by modifying the getSearchResults function in js/zap-common.js to increase the number of fetched results to 10. This change involves adding a single line of code to set the maxResults parameter to 10.


Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link
Contributor

@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 @RLalor - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 1 issue 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 to tell me if it was helpful.

@@ -6,6 +6,7 @@ function getSearchResults(query, youTubeDataApiKey, onData, onFail) {
key: youTubeDataApiKey,
part: "snippet",
q: query,
maxResults: 10,
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: Consider making maxResults configurable

Hardcoding the maxResults to 10 might limit the flexibility of the function. Consider making it a parameter so that the caller can specify the desired number of results.

Suggested change
maxResults: 10,
function fetchYouTubeData(query, maxResults = 10) {
$.get("https://www.googleapis.com/youtube/v3/search", {
key: youTubeDataApiKey,
part: "snippet",
q: query,
maxResults: maxResults,
type: "video"
}, onData).fail(onFail);
}

Copy link
Member

@shakeelmohamed shakeelmohamed left a comment

Choose a reason for hiding this comment

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

Looks great, thanks @RLalor!

@shakeelmohamed shakeelmohamed merged commit 08c9ad8 into zen-audio-player:main Jul 10, 2024
4 checks passed
@RLalor RLalor deleted the increase_search_results branch July 11, 2024 01:26
@RLalor
Copy link
Contributor Author

RLalor commented Jul 11, 2024

Thanks. This is a nice project to work on. The other changes you mention look quite easy as well. If I get bored I will play with and test those as well and discuss which option is most suited.
I tested it and it can fetch 50 results per page. If you try 51 it doesn't produce an error but just ignores it and gets 50. I think you can do 50 per page up to 1000 results / 20 pages. But I also read 500.
Perhaps adding 2 more columns to prevent the page becoming so long is worth considering as well.

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.

2 participants