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

Code before:
        'url': 'http://www.history.com/videos/history-of-valentines-day',
        'only_matching': True,
    }, {
        'url': 'https://play.aetv.com/shows/duck-dynasty/videos/best-of-duck-dynasty-getting-quack-in-shape',
        'only_matching': True,
    }]

    def _real_extract(self, url):
        domain, canonical = self._match_valid_url(url).groups()
        return self._extract_aetn_info(domain, 'canonical', '/' + canonical, url)


class AENetworksListBaseIE(AENetworksBaseIE):
    def _call_api(self, resource, slug, brand, fields):
            return self._download_json(
                'https://yoga.appsvcs.aetnd.com/graphql',
                slug, query={'brand': brand},
                data=json.dumps({
                    'query': '''{
    %s(slug: "%s") {
        %s
    }
    }''' % (resource, slug, fields),  # noqa: UP031
                }).encode(),
                headers={'Content-Type': 'application/json'},
            )['data'][resource]

    def _real_extract(self, url):
        domain, slug = self._match_valid_url(url).groups()
        _, brand, _ = self._DOMAIN_MAP[domain]
        playlist = self._call_api(self._RESOURCE, slug, brand, self._FIELDS)
        base_url = f'http://watch.{domain}'

        entries = []
        for item in (playlist.get(self._ITEMS_KEY) or []):
            doc = self._get_doc(item)
            canonical = doc.get('canonical')
            if not canonical:
                continue
            entries.append(self.url_result(
                base_url + canonical, AENetworksIE.ie_key(), doc.get('id')))

        description = None
        if self._PLAYLIST_DESCRIPTION_KEY:
            description = playlist.get(self._PLAYLIST_DESCRIPTION_KEY)

        return self.playlist_result(
            entries, playlist.get('id'),
            playlist.get(self._PLAYLIST_TITLE_KEY), description)



Review comment (suggestion):
just formatting
```suggestion
        return self._download_json(
            'https://yoga.appsvcs.aetnd.com/graphql', slug,
            query={'brand': brand}, headers={'Content-Type': 'application/json'},
            data=json.dumps({
                'query': '''{
  %s(slug: "%s") {
    %s
  }
}''' % (resource, slug, fields),  # noqa: UP031
            }).encode())['data'][resource]
```

Code after:
        'url': 'http://www.history.com/videos/history-of-valentines-day',
        'only_matching': True,
    }, {
        'url': 'https://play.aetv.com/shows/duck-dynasty/videos/best-of-duck-dynasty-getting-quack-in-shape',
        'only_matching': True,
    }]

    def _real_extract(self, url):
        domain, canonical = self._match_valid_url(url).groups()
        return self._extract_aetn_info(domain, 'canonical', '/' + canonical, url)


class AENetworksListBaseIE(AENetworksBaseIE):
    def _call_api(self, resource, slug, brand, fields):
        return self._download_json(
            'https://yoga.appsvcs.aetnd.com/graphql', slug,
            query={'brand': brand}, headers={'Content-Type': 'application/json'},
            data=json.dumps({
                'query': '''{
  %s(slug: "%s") {
    %s
  }
}''' % (resource, slug, fields),  # noqa: UP031
            }).encode())['data'][resource]

    def _real_extract(self, url):
        domain, slug = self._match_valid_url(url).groups()
        _, brand, _ = self._DOMAIN_MAP[domain]
        playlist = self._call_api(self._RESOURCE, slug, brand, self._FIELDS)
        base_url = f'http://watch.{domain}'

        entries = []
        for item in (playlist.get(self._ITEMS_KEY) or []):
            doc = self._get_doc(item)
            canonical = doc.get('canonical')
            if not canonical:
                continue
            entries.append(self.url_result(
                base_url + canonical, AENetworksIE.ie_key(), doc.get('id')))

        description = None
        if self._PLAYLIST_DESCRIPTION_KEY:
            description = playlist.get(self._PLAYLIST_DESCRIPTION_KEY)

        return self.playlist_result(
            entries, playlist.get('id'),
            playlist.get(self._PLAYLIST_TITLE_KEY), description)


class AENetworksCollectionIE(AENetworksListBaseIE):
    IE_NAME = 'aenetworks:collection'