# Buggy code
def _real_extract(self, url):
    video_id = self._match_id(url)
    self._set_cookie("cda.pl", "cda.player", "html5")
    webpage = self._download_webpage(self._BASE_URL + "/video/" + video_id, video_id)

    if "Ten film jest dostępny dla użytkowników premium" in webpage:
        raise ExtractorError(
            "This video is only available for premium users.", expected=True
        )

    need_confirm_age = False
    if self._html_search_regex(
        r'(<form[^>]+action="/a/validatebirth")',
        webpage,
        "birthday validate form",
        default=None,
    ):
        webpage = self._download_age_confirm_page(url, video_id, note="Confirming age")
        need_confirm_age = True

    formats = []

    uploader = self._search_regex(
        r"""(?x)
            <(span|meta)[^>]+itemprop=(["\'])author\2[^>]*>
            (?:<\1[^>]*>[^<]*</\1>|(?!</\1>)(?:.|\n))*?
            <(span|meta)[^>]+itemprop=(["\'])name\4[^>]*>(?P<uploader>[^<]+)</\3>
        """,
        webpage,
        "uploader",
        default=None,
        group="uploader",
    )
    view_count = self._search_regex(
        r"Odsłony:(?:\s|&nbsp;)*([0-9]+)", webpage, "view_count", default=None
    )
    average_rating = self._search_regex(
        r'<(?:span|meta)[^>]+itemprop=(["\'])ratingValue\1[^>]*>(?P<rating_value>[0-9.]+)',
        webpage,
        "rating",
        fatal=False,
        group="rating_value",
    )

    info_dict = {
        "id": video_id,
        "title": self._og_search_title(webpage),
        "description": self._og_search_description(webpage),
        "uploader": uploader,
        "view_count": int_or_none(view_count),
        "average_rating": float_or_none(average_rating),
        "thumbnail": self._og_search_thumbnail(webpage),
        "formats": formats,
        "duration": None,
        "age_limit": 18 if need_confirm_age else 0,
    }

    def extract_format(page, version):
        json_str = self._search_regex(
            r'player_data=(\\?["\'])(?P<player_data>.+?)\1',
            page,
            "%s player_json" % version,
            fatal=False,
            group="player_data",
        )
        if not json_str:
            return
        player_data = self._parse_json(
            json_str, "%s player_data" % version, fatal=False
        )
        if not player_data:
            return
        video = player_data.get("video")
        if not video or "file" not in video:
            self.report_warning("Unable to extract %s version information" % version)
            return
        if video["file"].startswith("uggc"):
            video["file"] = codecs.decode(video["file"], "rot_13")
            if video["file"].endswith("adc.mp4"):
                video["file"] = video["file"].replace("adc.mp4", ".mp4")
        f = {
            "url": video["file"],
        }
        m = re.search(
            r'<a[^>]+data-quality="(?P<format_id>[^"]+)"[^>]+href="[^"]+"[^>]+class="[^"]*quality-btn-active[^"]*">(?P<height>[0-9]+)p',
            page,
        )
        if m:
            f.update(
                {
                    "format_id": m.group("format_id"),
                    "height": int(m.group("height")),
                }
            )
        info_dict["formats"].append(f)
        if not info_dict["duration"]:
            info_dict["duration"] = parse_duration(video.get("duration"))

    extract_format(webpage, "default")

    for href, resolution in re.findall(
        r'<a[^>]+data-quality="[^"]+"[^>]+href="([^"]+)"[^>]+class="quality-btn"[^>]*>([0-9]+p)',
        webpage,
    ):
        if need_confirm_age:
            handler = self._download_age_confirm_page
        else:
            handler = self._download_webpage

        webpage = handler(
            self._BASE_URL + href,
            video_id,
            "Downloading %s version information" % resolution,
            fatal=False,
        )
        if not webpage:
            # Manually report warning because empty page is returned when
            # invalid version is requested.
            self.report_warning(
                "Unable to download %s version information" % resolution
            )
            continue

        extract_format(webpage, resolution)

    self._sort_formats(formats)

    return info_dict


# Traceback (ExtractorError)
youtube-dl -gvv https://www.cda.pl/video/9443700b
[debug] System config: [u'--prefer-free-formats']
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'-gvv', u'https://www.cda.pl/video/9443700b']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2017.08.13
[debug] Python version 2.7.13 - Linux-4.11.12-200.fc25.x86_64-x86_64-with-fedora-25-Gurgle
[debug] exe versions: ffmpeg 3.1.9, ffprobe 3.1.9
[debug] Proxy map: {}
WARNING: [CDA] default player_data: Failed to parse JSON Expecting property name enclosed in double quotes: line 1 column 2 (char 1)
WARNING: [CDA] 480p player_data: Failed to parse JSON Expecting property name enclosed in double quotes: line 1 column 2 (char 1)
WARNING: [CDA] 720p player_data: Failed to parse JSON Expecting property name enclosed in double quotes: line 1 column 2 (char 1)
WARNING: [CDA] 1080p player_data: Failed to parse JSON Expecting property name enclosed in double quotes: line 1 column 2 (char 1)
ERROR: No video formats found; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type  youtube-dl -U  to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
Traceback (most recent call last):
File "/usr/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 776, in extract_info
ie_result = ie.extract(url)
File "/usr/bin/youtube-dl/youtube_dl/extractor/common.py", line 433, in extract
ie_result = self._real_extract(url)
File "/usr/bin/youtube-dl/youtube_dl/extractor/cda.py", line 180, in _real_extract
self._sort_formats(formats)
File "/usr/bin/youtube-dl/youtube_dl/extractor/common.py", line 1057, in _sort_formats
raise ExtractorError('No video formats found')
ExtractorError: No video formats found; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type  youtube-dl -U  to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

# Fixed code
def _real_extract(self, url):
    video_id = self._match_id(url)
    self._set_cookie("cda.pl", "cda.player", "html5")
    webpage = self._download_webpage(self._BASE_URL + "/video/" + video_id, video_id)

    if "Ten film jest dostępny dla użytkowników premium" in webpage:
        raise ExtractorError(
            "This video is only available for premium users.", expected=True
        )

    need_confirm_age = False
    if self._html_search_regex(
        r'(<form[^>]+action="/a/validatebirth")',
        webpage,
        "birthday validate form",
        default=None,
    ):
        webpage = self._download_age_confirm_page(url, video_id, note="Confirming age")
        need_confirm_age = True

    formats = []

    uploader = self._search_regex(
        r"""(?x)
            <(span|meta)[^>]+itemprop=(["\'])author\2[^>]*>
            (?:<\1[^>]*>[^<]*</\1>|(?!</\1>)(?:.|\n))*?
            <(span|meta)[^>]+itemprop=(["\'])name\4[^>]*>(?P<uploader>[^<]+)</\3>
        """,
        webpage,
        "uploader",
        default=None,
        group="uploader",
    )
    view_count = self._search_regex(
        r"Odsłony:(?:\s|&nbsp;)*([0-9]+)", webpage, "view_count", default=None
    )
    average_rating = self._search_regex(
        r'<(?:span|meta)[^>]+itemprop=(["\'])ratingValue\1[^>]*>(?P<rating_value>[0-9.]+)',
        webpage,
        "rating",
        fatal=False,
        group="rating_value",
    )

    info_dict = {
        "id": video_id,
        "title": self._og_search_title(webpage),
        "description": self._og_search_description(webpage),
        "uploader": uploader,
        "view_count": int_or_none(view_count),
        "average_rating": float_or_none(average_rating),
        "thumbnail": self._og_search_thumbnail(webpage),
        "formats": formats,
        "duration": None,
        "age_limit": 18 if need_confirm_age else 0,
    }

    def extract_format(page, version):
        json_str = self._html_search_regex(
            r'player_data=(\\?["\'])(?P<player_data>.+?)\1',
            page,
            "%s player_json" % version,
            fatal=False,
            group="player_data",
        )
        if not json_str:
            return
        player_data = self._parse_json(
            json_str, "%s player_data" % version, fatal=False
        )
        if not player_data:
            return
        video = player_data.get("video")
        if not video or "file" not in video:
            self.report_warning("Unable to extract %s version information" % version)
            return
        if video["file"].startswith("uggc"):
            video["file"] = codecs.decode(video["file"], "rot_13")
            if video["file"].endswith("adc.mp4"):
                video["file"] = video["file"].replace("adc.mp4", ".mp4")
        f = {
            "url": video["file"],
        }
        m = re.search(
            r'<a[^>]+data-quality="(?P<format_id>[^"]+)"[^>]+href="[^"]+"[^>]+class="[^"]*quality-btn-active[^"]*">(?P<height>[0-9]+)p',
            page,
        )
        if m:
            f.update(
                {
                    "format_id": m.group("format_id"),
                    "height": int(m.group("height")),
                }
            )
        info_dict["formats"].append(f)
        if not info_dict["duration"]:
            info_dict["duration"] = parse_duration(video.get("duration"))

    extract_format(webpage, "default")

    for href, resolution in re.findall(
        r'<a[^>]+data-quality="[^"]+"[^>]+href="([^"]+)"[^>]+class="quality-btn"[^>]*>([0-9]+p)',
        webpage,
    ):
        if need_confirm_age:
            handler = self._download_age_confirm_page
        else:
            handler = self._download_webpage

        webpage = handler(
            self._BASE_URL + href,
            video_id,
            "Downloading %s version information" % resolution,
            fatal=False,
        )
        if not webpage:
            # Manually report warning because empty page is returned when
            # invalid version is requested.
            self.report_warning(
                "Unable to download %s version information" % resolution
            )
            continue

        extract_format(webpage, resolution)

    self._sort_formats(formats)

    return info_dict