from pathlib import Path


def parse_pb_name_data(file_name):
    """Returns data encoded in extraction files, such as datetime or itp id.

    >>> parse_pb_name_data("2021-01-01__1__0__filename__etc")
    {'extraction_date': '2021-01-01', 'itp_id': 1, 'url_number': 0, 'src_fname': 'filename'}

    """

    extraction_date, itp_id, url_number, src_fname, *_ = Path(file_name).name.split(
        "__"
    )
    return dict(
        extraction_date=extraction_date,
        itp_id=int(itp_id),
        url_number=int(url_number),
        src_fname=src_fname,
    )