Conversation
There was a problem hiding this comment.
Hey - I've found 3 issues, and left some high level feedback:
- The new getStriver/getNeetcode helpers fetch remote JSON on every use; consider memoizing or reusing the fetched data (and using Promise.all for parallel fetches) to avoid repeated network calls when navigating between solutions.
- getStriver currently extracts video IDs only from
youtu.beURLs and assumes a non-null yt_link; broaden the parsing to support standardyoutube.com/watch?v=links and gracefully handle missing or malformed entries to reduce silent failures. - The YouTube search link in SolutionVideos uses
target="_blank"without arelattribute; addrel="noopener noreferrer"to avoid potential security and performance issues when opening new tabs.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The new getStriver/getNeetcode helpers fetch remote JSON on every use; consider memoizing or reusing the fetched data (and using Promise.all for parallel fetches) to avoid repeated network calls when navigating between solutions.
- getStriver currently extracts video IDs only from `youtu.be` URLs and assumes a non-null yt_link; broaden the parsing to support standard `youtube.com/watch?v=` links and gracefully handle missing or malformed entries to reduce silent failures.
- The YouTube search link in SolutionVideos uses `target="_blank"` without a `rel` attribute; add `rel="noopener noreferrer"` to avoid potential security and performance issues when opening new tabs.
## Individual Comments
### Comment 1
<location path="src/utils/api.ts" line_range="122-131" />
<code_context>
return Object.values(questions)
}
+export async function getStriver(problemSlug: string) {
+ const lcLink = `https://leetcode.com/problems/${problemSlug}/`
+
+ const res = await fetch(
+ 'https://raw.githubusercontent.com/hitarth-gg/CP/main/striver-a2z.json',
+ )
+ const json: StriverData[] = await res.json()
+
+ const ytLink = json
+ .flatMap((step) => step.sub_steps)
+ .flatMap((subStep) => subStep.topics)
+ .find((topic) => topic.lc_link === lcLink)?.yt_link
+
+ const videoId = ytLink?.match(/youtu\.be\/([^?]+)/)?.[1]
+ return videoId
+}
</code_context>
<issue_to_address>
**issue:** Video ID extraction from Striver data only handles `youtu.be` short links.
The current regex only extracts IDs from `youtu.be` links, so `videoId` will be `undefined` for other valid YouTube URL formats (e.g., `youtube.com/watch`, `/embed/`, etc.). It would be more robust to handle multiple common YouTube URL patterns or use a shared helper to normalize IDs from different URL shapes.
</issue_to_address>
### Comment 2
<location path="src/utils/api.ts" line_range="125-134" />
<code_context>
+export async function getStriver(problemSlug: string) {
+ const lcLink = `https://leetcode.com/problems/${problemSlug}/`
+
+ const res = await fetch(
+ 'https://raw.githubusercontent.com/hitarth-gg/CP/main/striver-a2z.json',
+ )
+ const json: StriverData[] = await res.json()
+
+ const ytLink = json
+ .flatMap((step) => step.sub_steps)
+ .flatMap((subStep) => subStep.topics)
+ .find((topic) => topic.lc_link === lcLink)?.yt_link
+
+ const videoId = ytLink?.match(/youtu\.be\/([^?]+)/)?.[1]
+ return videoId
+}
+
+export async function getNeetcode(problemSlug: string) {
+ const res = await fetch(
+ 'https://raw.githubusercontent.com/neetcode-gh/leetcode/main/.problemSiteData.json',
+ )
+ const json: NeetcodeData = await res.json()
+ const videoId = json.find(({ link }) => link === `${problemSlug}/`)?.video
+ return videoId
</code_context>
<issue_to_address>
**issue:** Network and JSON parsing failures in `getNeetcode`/`getStriver` are not handled.
These functions assume `fetch` and `res.json()` always succeed. In a content script, rejected promises can break the feature. Consider wrapping the calls in `try/catch`, returning `undefined` on failure and optionally logging (e.g. `console.debug`) so the YouTube search fallback can still render.
</issue_to_address>
### Comment 3
<location path="src/components/SolutionVideos.tsx" line_range="40-45" />
<code_context>
+
+function Search({ question }: Pick<Props, 'question'>) {
+ return (
+ <a
+ href={`https://www.youtube.com/results?search_query=${encodeURIComponent(
+ `${question.id}. ${question.title} LeetCode`,
+ )}`}
+ target='_blank'
+ className='bg-fill-secondary hover:bg-fill-primary inline-flex
+ items-center gap-2 rounded-lg border px-3 py-2 transition'
+ >
</code_context>
<issue_to_address>
**🚨 issue (security):** External link opened with `target="_blank"` should use `rel="noopener noreferrer"`.
This external link opens a new tab without `rel="noopener noreferrer"`, which lets the new page access `window.opener`. Please add `rel="noopener noreferrer"` to this anchor for safer handling of `target="_blank"` links.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Sbrjt
force-pushed
the
video-sol
branch
3 times, most recently
from
August 3, 2026 06:59
8083174 to
40c7e92
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary by Sourcery
Add support for showing Neetcode and Striver YouTube solution videos on LeetCode solution pages and expose a corresponding user setting.
New Features:
Enhancements:
Build:
Documentation: