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

Code before:
          crops {
            name
            renditions {
              name
              width
              height
              url
            }
          }
        }
      }
      renditions {
        type
        width
        height
        url
        bitrate
      }
      summary
    }
  }
}'''

    def _build_playlist(self, media_items):
        for media_id in media_items:
            json_obj = traverse_obj(self._json_from_graphql(media_id) or {}, ('data', 'video'))

            title = json_obj.get('promotionalHeadline') or media_id
            description = json_obj.get('summary')
            creators = ', '.join(
                [remove_start(creator, 'By ') for creator in traverse_obj(
                    json_obj, ('bylines', ..., 'renderedRepresentation'))])
            duration = int_or_none(json_obj.get('duration'))
            formats, subtitles = self._extract_media_from_json(media_id, json_obj)

            yield {
                'id': media_id,
                'title': title,
                'description': description,
                'duration': duration,
                'creator': creators,  # TODO: change to 'creators'
                'formats': formats,
                'subtitles': subtitles,
                'thumbnails': self._extract_thumbnails(
                    traverse_obj(json_obj, ('promotionalMedia', 'crops', ..., 'renditions', ...))),
            }

    def _json_from_graphql(self, media_id):
        # reference: `id-to-uri.js`
        video_uuid = uuid.uuid5(self._DNS_NAMESPACE, 'video')
        media_uuid = uuid.uuid5(video_uuid, media_id)

Review comment (suggestion):
```suggestion
            json_obj = self._call_api(media_id)
```

Code after:
            return self.playlist_result(
                [self._extract_video(media_id) for media_id in media_ids], page_id, title, description)

        return {
            **self._extract_video(lead_video_id),
            'title': title,
            'description': description,
            'creator': self._search_regex(  # TODO: change to 'creators'
                r'<span itemprop="author">([^<]+)</span></p>', webpage, 'author', default=None),
        }


class NYTimesCookingRecipeIE(InfoExtractor):
    _VALID_URL = r'https?://cooking\.nytimes\.com/recipes/(?P<id>\d+)'
    _TESTS = [{
        'url': 'https://cooking.nytimes.com/recipes/1017817-cranberry-curd-tart',
        'md5': '579e83bbe8e61e9de67f80edba8a78a8',
        'info_dict': {
            'id': '1017817',
            'ext': 'mp4',
            'title': 'Cranberry Curd Tart',
            'description': 'md5:ad77a3fc321db636256d4343c5742152',
            'timestamp': 1447804800,
            'upload_date': '20151118',
            'creator': 'David Tanis',
            'thumbnail': r're:https?://\w+\.nyt.com/images/.*\.jpg',
        },
    }, {
        'url': 'https://cooking.nytimes.com/recipes/1024781-neapolitan-checkerboard-cookies',
        'md5': '58df35998241dcf0620e99e646331b42',
        'info_dict': {
            'id': '1024781',
            'ext': 'mp4',
            'title': 'Neapolitan Checkerboard Cookies',
            'description': 'md5:ba12394c585ababea951cb6d2fcc6631',
            'timestamp': 1701302400,
            'upload_date': '20231130',
            'creator': 'Sue Li',
            'thumbnail': r're:https?://\w+\.nyt.com/images/.*\.jpg',
        },
    }, {
        'url': 'https://cooking.nytimes.com/recipes/1019516-overnight-oats',
        'md5': '2fe7965a3adc899913b8e25ada360823',
        'info_dict': {
            'id': '1019516',
            'ext': 'mp4',
            'timestamp': 1546387200,
            'description': 'md5:8856ce10239161bd2596ac335b9f9bfb',
            'upload_date': '20190102',
            'title': 'Overnight Oats',
            'creator': 'Genevieve Ko',