Пример #1
0
def clean():
    from tools import cleaner
    cleaner()
Пример #2
0
                   'Blended': 'No', 'Remarks': '', 'Course_Delivery_Mode': 'Normal', 'Free TAFE': 'No'}
    time.sleep(10)
    # Find website
    course_data['Website'] = pure_url

    # Find cost
    time.sleep(10)
    containers = soup.find_all('div', {'class', 'module__content-panel--text module__content-panel--text--course'})
    cost_container = []
    cost = []
    for container in containers:
        title = container.find('div', {'class', 'module__key-information--item-title'})
        if title:
            if "Estimated tuition fee" in title.text:
                cost_container = container.find('div', {'class', 'module__key-information--item-content'}).text
                cost_container = tools.cleaner(cost_container)
                cost_text = cost_container
                cost = cost_text[:cost_text.index('f')]
                break

    del cost_container
    course_data['Int_Fees'] = cost
    print(cost)

    # Find course title
    title = soup.find('h1')
    course_data['Course'] = title.text
    print(title.text)
    # Decide level code
    for i in level_key:
        for j in level_key[i]:
Пример #3
0
        print(course_data['Course'])

        # Decide level code
        course_data['Level_Code'] = data.course_title(course_data['Course'])

        if "Honours" in course_data['Course'] or "honours" in course_data[
                'Course']:
            course_data['Level_Code'] += 'H'

        # Find information container
        details = soup.find_all('dl')

        try:
            # find international fees
            imperfect = details[1].find('a').text
            imperfect = tools.cleaner(imperfect)

            fees = imperfect[:imperfect.index('(')]
            course_data['Int_Fees'] = fees
        except (IndexError, AttributeError):
            course_data['Int_Fees'] = "NA"

        # Find location
        location_tag = details[0].find('dd')
        locations = location_tag.text.strip()
        actual_cities = []

        for i in possible_cities:
            if i in locations:
                actual_cities.append(i)