Skip to content

Add universal endpoints - #2

Merged
rafalzawadzki merged 4 commits into
masterfrom
claude/update-n8n-api-endpoints-01W6Yhy2WMdVh7FDixjQSMsA
Nov 23, 2025
Merged

Add universal endpoints#2
rafalzawadzki merged 4 commits into
masterfrom
claude/update-n8n-api-endpoints-01W6Yhy2WMdVh7FDixjQSMsA

Conversation

@rafalzawadzki

@rafalzawadzki rafalzawadzki commented Nov 23, 2025

Copy link
Copy Markdown
  • Replace "Get YouTube Video" with universal "Get Metadata"
  • Replace "Get YouTube Transcript" with universal "Get Transcript"
  • Add lang and mode options to "Get Transcript" feature

The new universal features support YouTube, Instagram, TikTok, X (Twitter) and more platforms coming soon.

Note: this PR introduces breaking changes.

- Migrate from /youtube/video to /metadata endpoint
- Migrate from /youtube/transcript to /transcript endpoint
- Add mode parameter to transcript endpoint for AI fallback support
- Update descriptions to reflect multi-platform support (YouTube, TikTok, etc.)
- Bump version to 0.2.8
- Update /metadata endpoint to use 'url' parameter instead of 'id'
- Update /transcript endpoint to use only 'url' parameter
- Remove conditional logic for videoId vs url in transcript
- Update mode parameter values to 'native', 'auto', 'generate' per spec
- Change default mode from 'default' to 'auto'
Breaking changes:
- Move getMetadata and getTranscript to new "Media" resource
- Rename "Get Video" to "Get Metadata" with action "Get metadata"
- Change default resource from "youtube" to "media"

New features:
- Add "Media" resource for universal multi-platform operations
- Add language (lang) parameter to transcript endpoint
- Support for YouTube, TikTok, Instagram, Twitter in Media operations

Improvements:
- Separate universal operations from YouTube-specific operations
- Keep YouTube operations for channel and playlist management
- Maintain backward compatibility with old YouTube video/transcript operations

Version: 0.3.0
@claude

claude Bot commented Nov 23, 2025

Copy link
Copy Markdown

Claude finished @rafalzawadzki's task —— View job


Pull Request Review

I've completed a comprehensive review of this PR that introduces universal endpoints for the Supadata n8n node. Here's my analysis:

Review Progress

  • Read CLAUDE.md for repo-specific guidelines
  • Examine modified files to understand the changes
  • Analyze code quality and best practices
  • Check for potential bugs and issues
  • Review performance considerations
  • Assess security concerns
  • Evaluate test coverage
  • Provide comprehensive review feedback

Code Quality & Best Practices

Strengths:

  • Clean architecture: Well-structured separation between universal Media operations and legacy YouTube operations
  • Backward compatibility: Excellent approach maintaining existing YouTube operations while introducing universal alternatives
  • Consistent patterns: Follows established n8n node conventions and patterns
  • Clear naming: Operation names like "Get Metadata" and "Get Transcript" are descriptive and user-friendly
  • Proper TypeScript: Good use of type definitions and interfaces from n8n-workflow

Minor suggestions:

  • Consider adding JSDoc comments for complex operations like transcript mode handling
  • The displayOptions logic is well-structured but could benefit from constants for repeated values

🐛 Potential Issues

Critical:

  • Missing null checks: Lines 406-408 and 439-441 should validate lang parameter before adding to query string
  • Inconsistent error handling: YouTube operations (lines 421-499) lack the same error context as Media operations

Medium:

  • Parameter validation: videoUrl and other URL inputs should be validated for basic URL format
  • Type safety: Consider using enums for mode values instead of string literals (lines 126-142)

Suggested fixes:

// Add validation for lang parameter
const lang = this.getNodeParameter('lang', i) as string;
if (lang && lang.trim()) {
    qs.lang = lang.trim();
}

// Add URL validation
const videoUrl = this.getNodeParameter('videoUrl', i) as string;
if (!videoUrl || (!videoUrl.includes('youtube.com') && !videoUrl.includes('youtu.be') && !videoUrl.includes('tiktok.com') && !videoUrl.includes('instagram.com') && !videoUrl.includes('twitter.com') && !videoUrl.includes('x.com'))) {
    throw new Error('Invalid video URL or unsupported platform');
}

Performance Considerations

Good practices:

  • Efficient API request structure with proper query parameters
  • Good use of conditional parameter inclusion (lines 406-409, 439-442)

Recommendations:

  • Consider adding request timeout configuration for external API calls
  • The loop structure (lines 381-529) is efficient for batch processing

🔒 Security Assessment

Concerns:

  • Input sanitization: URLs are passed directly to API without validation (videoUrl, channelId, playlistId)
  • Parameter injection: User inputs should be sanitized before being added to query strings

Recommendations:

  • Add URL format validation before API calls
  • Sanitize string parameters to prevent injection attacks
  • Consider rate limiting for API requests

🧪 Test Coverage

Major concern:

  • No test files found: The repository lacks any test files or test directory
  • Breaking changes without tests: Given this introduces breaking changes, comprehensive test coverage is critical

Critical recommendations:

  1. Add unit tests for all new Media operations
  2. Add integration tests for API endpoints
  3. Add regression tests for backward compatibility with YouTube operations
  4. Test error handling and edge cases (invalid URLs, network failures)

📋 Additional Observations

Positive changes:

  • Version bump to 0.3.0 appropriate for breaking changes
  • Clean separation of concerns between different resource types
  • Good UX with descriptive placeholders and help text

Missing documentation:

  • No migration guide for users moving from YouTube-specific to universal operations
  • API endpoint documentation could be helpful for developers

🎯 Recommendations

Before merging:

  1. Add input validation for URL parameters
  2. Implement basic test coverage (at minimum, unit tests for the execute method)
  3. Add error handling improvements for edge cases
  4. Consider adding parameter sanitization

Future improvements:

  1. Add comprehensive test suite
  2. Create migration documentation
  3. Consider adding request timeout configuration
  4. Add JSDoc documentation for complex operations

📊 Summary

This PR successfully implements universal endpoints while maintaining backward compatibility. The code quality is good, but lacks test coverage which is concerning for breaking changes. The main issues are around input validation and security considerations that should be addressed before merging.

Recommendation: Approve with requested changes - Address input validation and add basic test coverage before merging.

@claude

claude Bot commented Nov 23, 2025

Copy link
Copy Markdown

Claude encountered an error —— View job


Pull Request Review

I'll provide a comprehensive review of this PR that introduces universal endpoints for the Supadata n8n node. Here's my review plan:

Review Progress

  • Read CLAUDE.md for repo-specific guidelines
  • Examine modified files to understand the changes
  • Analyze code quality and best practices
  • Check for potential bugs and issues
  • Review performance considerations
  • Assess security concerns
  • Evaluate test coverage
  • Provide comprehensive review feedback

Starting analysis...

@rafalzawadzki
rafalzawadzki merged commit 1c95ac3 into master Nov 23, 2025
1 check failed
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