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

Code before:
        return self._download_json(
            'https://www.pinterest.com/resource/%sResource/get/' % resource,
            video_id, 'Download %s JSON metadata' % resource, query={
                'data': json.dumps({'options': options})
            })['resource_response']

    def _extract_video(self, data, extract_formats=True):
        video_id = data['id']
        thumbnails = []
        images = data.get('images')
        if isinstance(images, dict):
            for thumbnail_id, thumbnail in images.items():
                if not isinstance(thumbnail, dict):
                    continue
                thumbnail_url = url_or_none(thumbnail.get('url'))
                if not thumbnail_url:
                    continue
                thumbnails.append({
                    'url': thumbnail_url,
                    'width': int_or_none(thumbnail.get('width')),
                    'height': int_or_none(thumbnail.get('height')),
                })

        info = {
            'id': video_id,
            'title': (data.get('title') or data.get('grid_title') or video_id).strip(),
            'description': data.get('seo_description') or data.get('description'),
            'timestamp': unified_timestamp(data.get('created_at')),
            'thumbnails': thumbnails,
            'uploader': traverse_obj(data, ('closeup_attribution', 'full_name')),
            'uploader_id': str_or_none(traverse_obj(data, ('closeup_attribution', 'id'))),
            'repost_count': int_or_none(data.get('repin_count')),
            'comment_count': int_or_none(data.get('comment_count')),
            'categories': traverse_obj(data, ('pin_join', 'visual_annotation'), expected_type=list),
            'tags': traverse_obj(data, 'hashtags', expected_type=list),
            'extractor_key': PinterestIE.ie_key(),
        }

        urls = []
        formats = []
        duration = None
        domain = data.get('domain', '')
        if domain.lower() != 'uploaded by user' and traverse_obj(data, ('embed', 'src')):
            info.update({
                '_type': 'url_transparent',
                'url': data['embed']['src'],
            })
        elif extract_formats:
            video_list = traverse_obj(
                data, ('videos', 'video_list'),
                ('story_pin_data', 'pages', ..., 'blocks', ..., 'video', 'video_list'),

Review comment (suggestion):
```suggestion
            'title': strip_or_none(traverse_obj(data, 'title', 'grid_title') or video_id)),
```

Code after:
            com|fr|de|ch|jp|cl|ca|it|co\.uk|nz|ru|com\.au|at|pt|co\.kr|es|com\.mx|
            dk|ph|th|com\.uy|co|nl|info|kr|ie|vn|com\.vn|ec|mx|in|pe|co\.at|hu|
            co\.in|co\.nz|id|com\.ec|com\.py|tw|be|uk|com\.bo|com\.pe)'''

    def _call_api(self, resource, video_id, options):
        return self._download_json(
            'https://www.pinterest.com/resource/%sResource/get/' % resource,
            video_id, 'Download %s JSON metadata' % resource, query={
                'data': json.dumps({'options': options})
            })['resource_response']

    def _extract_video(self, data, extract_formats=True):
        video_id = data['id']
        thumbnails = []
        images = data.get('images')
        if isinstance(images, dict):
            for thumbnail_id, thumbnail in images.items():
                if not isinstance(thumbnail, dict):
                    continue
                thumbnail_url = url_or_none(thumbnail.get('url'))
                if not thumbnail_url:
                    continue
                thumbnails.append({
                    'url': thumbnail_url,
                    'width': int_or_none(thumbnail.get('width')),
                    'height': int_or_none(thumbnail.get('height')),
                })

        info = {
            'title': strip_or_none(traverse_obj(data, 'title', 'grid_title', default='')),
            'description': traverse_obj(data, 'seo_description', 'description'),
            'timestamp': unified_timestamp(data.get('created_at')),
            'thumbnails': thumbnails,
            'uploader': traverse_obj(data, ('closeup_attribution', 'full_name')),
            'uploader_id': str_or_none(traverse_obj(data, ('closeup_attribution', 'id'))),
            'repost_count': int_or_none(data.get('repin_count')),
            'comment_count': int_or_none(data.get('comment_count')),
            'categories': traverse_obj(data, ('pin_join', 'visual_annotation'), expected_type=list),
            'tags': traverse_obj(data, 'hashtags', expected_type=list),
        }

        urls = []
        formats = []
        duration = None
        domain = data.get('domain', '')
        if domain.lower() != 'uploaded by user' and traverse_obj(data, ('embed', 'src')):
            if not info['title']:
                info['title'] = None
            return {
                '_type': 'url_transparent',
                'url': data['embed']['src'],