Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/youtube.py (Python)

Code before:
                'clientName': client_name,
                'clientVersion': client_version,
            }
        }
        visitor_data = try_get(ytcfg, lambda x: x['VISITOR_DATA'],
                               compat_str)
        if visitor_data:
            context['client']['visitorData'] = visitor_data
        return context

    def _generate_api_headers(self, ytcfg=None, identity_token=None, account_syncid=None, visitor_data=None):
        headers = {
            'X-YouTube-Client-Name': '1',
            'X-YouTube-Client-Version': self.__extract_client_version(ytcfg),
        }
        if identity_token:
            headers['x-youtube-identity-token'] = identity_token
        if account_syncid:
            headers['X-Goog-PageId'] = account_syncid
            headers['X-Goog-AuthUser'] = 0
        if visitor_data:
            headers['x-goog-visitor-id'] = visitor_data
        auth = self._generate_sapisidhash_header()
        if auth is not None:
            headers['Authorization'] = auth
            headers['X-Origin'] = 'https://www.youtube.com'  # What about music.youtube.com etc.?
        return headers

    def _extract_video(self, renderer):
        video_id = renderer.get('videoId')
        title = try_get(
            renderer,
            (lambda x: x['title']['runs'][0]['text'],
             lambda x: x['title']['simpleText']), compat_str)
        description = try_get(
            renderer, lambda x: x['descriptionSnippet']['runs'][0]['text'],
            compat_str)
        duration = parse_duration(try_get(
            renderer, lambda x: x['lengthText']['simpleText'], compat_str))
        view_count_text = try_get(
            renderer, lambda x: x['viewCountText']['simpleText'], compat_str) or ''
        view_count = str_to_int(self._search_regex(
            r'^([\d,]+)', re.sub(r'\s', '', view_count_text),
            'view count', default=None))
        uploader = try_get(
            renderer,
            (lambda x: x['ownerText']['runs'][0]['text'],
             lambda x: x['shortBylineText']['runs'][0]['text']), compat_str)
        return {
            '_type': 'url',
            'ie_key': YoutubeIE.ie_key(),

Review comment (suggestion):
We always download from `www.youtube.com` even if the link given by user is from another subdomain
```suggestion
            headers['X-Origin'] = 'https://www.youtube.com'
```

Code after:
        # Recreate the client context (required)
        client_version = self.__extract_client_version(ytcfg)
        client_name = try_get(ytcfg, lambda x: x['INNERTUBE_CLIENT_NAME'], compat_str) or 'WEB'
        context = {
            'client': {
                'clientName': client_name,
                'clientVersion': client_version,
            }
        }
        visitor_data = try_get(ytcfg, lambda x: x['VISITOR_DATA'], compat_str)
        if visitor_data:
            context['client']['visitorData'] = visitor_data
        return context

    def _generate_api_headers(self, ytcfg=None, identity_token=None, account_syncid=None, visitor_data=None):
        headers = {
            'X-YouTube-Client-Name': '1',
            'X-YouTube-Client-Version': self.__extract_client_version(ytcfg),
        }
        if identity_token:
            headers['x-youtube-identity-token'] = identity_token
        if account_syncid:
            headers['X-Goog-PageId'] = account_syncid
            headers['X-Goog-AuthUser'] = 0
        if visitor_data:
            headers['x-goog-visitor-id'] = visitor_data
        auth = self._generate_sapisidhash_header()
        if auth is not None:
            headers['Authorization'] = auth
            headers['X-Origin'] = 'https://www.youtube.com'
        return headers

    def _extract_video(self, renderer):
        video_id = renderer.get('videoId')
        title = try_get(
            renderer,
            (lambda x: x['title']['runs'][0]['text'],
             lambda x: x['title']['simpleText']), compat_str)
        description = try_get(
            renderer, lambda x: x['descriptionSnippet']['runs'][0]['text'],
            compat_str)
        duration = parse_duration(try_get(
            renderer, lambda x: x['lengthText']['simpleText'], compat_str))
        view_count_text = try_get(
            renderer, lambda x: x['viewCountText']['simpleText'], compat_str) or ''
        view_count = str_to_int(self._search_regex(
            r'^([\d,]+)', re.sub(r'\s', '', view_count_text),
            'view count', default=None))
        uploader = try_get(
            renderer,
            (lambda x: x['ownerText']['runs'][0]['text'],