def extract_coaching_start_date(page):
    start_date = ''
    start_date_text = page.find('div',attrs={"class":"flip-container"}).find("div",attrs={"class":"front"}).find("p",                                                                                             attrs={"class":"info"}).text
    month = find_month(start_date_text)
    year = find_year(start_date_text)
    date = find_coaching_start_date(start_date_text)
    start_date = f'{year}-{month}-{date}'

    return start_date
def extract_coaching_end_date(page):
    end_date = ''
    end_date_text = page.find_all('div',attrs={"class":"flip-container"})[2].find("div",attrs={"class":"front"}).find(
        "p",
                                                                                                               attrs={"class":"info"}).text
    month = find_month(end_date_text)
    year = find_year(end_date_text)
    date = find_coaching_end_date(end_date_text)
    end_date = f'{year}-{month}-{date}'

    return end_date
示例#3
0
def deal_with_globle_ceo_start_date(start_date):
    month = find_month(start_date)
    year = find_year(start_date)
    date = extract_en_globle_ceo_date_digit(start_date)
    start_date = f'{year}-{month}-{date}'
    return start_date
示例#4
0
def deal_with_trans_start_date(start_date):
    month = find_month(start_date)
    year = find_year(start_date)
    date = extract_es_trans_date_digit(start_date)
    start_date = f'{year}-{month}-{date}'
    return start_date
示例#5
0
def online_version_detail(page):
    location = ''
    version = 2
    effective_date_start = ''
    effective_date_end = ''
    tuition_number = ''
    currency = ''
    tuition_note = ''
    credential = ''
    type = 'Online-Virtual'
    duration_type = ''
    duration_num = ''
    schedule = [["", "", "", "formal"]]
    languages = 'English'
    try:
        location = page.find('div', attrs={
            "class": "fourcol last"
        }).find('div', attrs={
            "class": "segment clearfix cajita_datos"
        }).find_all('p')[1].strong.text
        location = format_location(location, '')
    except:
        pass
    try:
        page.find('div', attrs={
            "class": "fourcol last"
        }).find('div', attrs={
            "class": "segment clearfix cajita_datos"
        }).find_all('p')[1].strong.extract()
        start_date = page.find('div', attrs={
            "class": "fourcol last"
        }).find('div', attrs={
            "class": "segment clearfix cajita_datos"
        }).find_all('p')[1].text

        year = re.findall('\d{4}', start_date)[0]
        date = re.findall('\d{1,2}', start_date)[0]
        if len(date) < 2:
            date = '0' + date
        month = find_month(start_date)
        effective_date_start = f'{year}-{month}-{date}'
    except Exception as e:
        print(e)

    try:
        date_info = page.find('div', attrs={
            "class": "fourcol last"
        }).find('div', attrs={
            "class": "segment clearfix cajita_datos"
        }).find_all('p')[1].text
        duration_type = get_duration_type(date_info)
        duration_type = 'duration_' + duration_type
        duration_num = re.findall('\d{1}', date_info)[-1]
    except Exception as e:
        print(e)
    try:
        price_related_session = page.find('div',
                                          attrs={"class": "toggle-label"},
                                          text="Live Online Edition Admission "
                                          "Process & Fees")
        price_session = price_related_session.find_next('div').find(
            'strong', text='General fee').find_parent('li').text
        tuition_number = get_tuition_number(price_session)
        currency = get_currency_type(price_session)
        tuition_note = price_related_session.find_next('div').find('ul').text
        if 'Certificate' in tuition_note:
            credential = 'Certificate'
    except:
        pass
    try:
        schedule[0][0] = effective_date_start
        schedule[0][1] = effective_date_end
        schedule[0][2] = str(duration_num)
    except:
        pass

    info = {
        'location': location,
        'version': version,
        'tuition_number': tuition_number,
        'currency': currency,
        'tuition_note': tuition_note,
        'credential': credential,
        'effective_date_start': effective_date_start,
        'effective_date_end': effective_date_end,
        'type': type,
        'schedule': schedule,
        'languages': languages
    }
    if 'weeks' in date_info:
        duration_info = {duration_type: duration_num}
        info.update(duration_info)
    return info