Exemplo n.º 1
0
def hotflog_main(search_list):

    # Hotflog検索処理
    logger.info('Hotflog検索処理を開始します')
    HOTFLOG_BASE_URL = "https://www.hotfrog.jp/"

    SITE_NAME = 'Hotflog'

    # ドライバー生成処理
    driver = scraip.create_driver(headless_flg=False)

    sheet_index = 1

    for search_dr in search_list:

        target_url = HOTFLOG_BASE_URL + 'search/' + \
            search_dr.prefecture + '/' + search_dr.industry

        output_excel_list = []

        output_list = scraip.search_hotflog(
            driver, target_url, search_dr.prefecture, search_dr.industry)
        output_excel_list.extend(output_list)

        excel.out_to_excel(output_excel_list, search_dr.industry +
                           "_" + search_dr.prefecture, search_dr, SITE_NAME, 8)

        # 辞書にシート名を登録
        global_hotflog_sheetname_dic[sheet_index] = search_dr.industry + \
            "_" + search_dr.prefecture
        sheet_index += 1

    # ブラウザを終了する。
    driver.quit()
Exemplo n.º 2
0
def jouhouya_main(search_list):

    # 街の情報屋さんキーワード検索処理
    logger.info('街の情報屋さん検索処理を開始します')
    JOHOUYA_BASE_URL = "https://www.24u.jp/"

    SITE_NAME = '街の情報屋さん'

    # ドライバー生成処理
    driver = scraip.create_driver()

    sheet_index = 1

    for search_dr in search_list:

        target_url = JOHOUYA_BASE_URL

        output_excel_list = []

        output_list = scraip.search_jouhouya(
            driver, target_url, search_dr.prefecture, search_dr.industry)
        output_excel_list.extend(output_list)

        excel.out_to_excel(output_excel_list, search_dr.industry +
                           "_" + search_dr.prefecture, search_dr, SITE_NAME, 4)

        # 辞書にシート名を登録
        global_johouya_sheetname_dic[sheet_index] = search_dr.industry + \
            "_" + search_dr.prefecture
        sheet_index += 1

    # ブラウザを終了する。
    driver.quit()
Exemplo n.º 3
0
def odekake_main(search_list):

    # おでかけタウン情報キーワード検索処理
    logger.info('おでかけタウン情報検索処理を開始します')
    ODEKAKE_BASE_URL = "http://www.gekinavi.net/"

    SITE_NAME = 'おでかけタウン情報'

    # ドライバー生成処理
    driver = scraip.create_driver()

    sheet_index = 1

    for search_dr in search_list:

        target_url = ODEKAKE_BASE_URL

        output_excel_list = []
        sheet_name = ''
        if len(search_dr.target_industry_str):
            sheet_name = (search_dr.industry + "_" + search_dr.prefecture +
                          "_" + search_dr.target_industry_str)[:30]
        else:
            sheet_name = (search_dr.industry + "_" + search_dr.prefecture)[:30]

        output_list = scraip.search_odekake(
            driver, target_url, search_dr.prefecture, search_dr.industry)
        output_excel_list.extend(output_list)

        excel.out_to_excel(output_excel_list, sheet_name,
                           search_dr, SITE_NAME, 5)

        # 辞書にシート名を登録
        global_odekake_sheetname_dic[sheet_index] = sheet_name
        sheet_index += 1

    # ブラウザを終了する。
    driver.quit()
Exemplo n.º 4
0
def giftshop_main(search_list):

    # ギフトショップキーワード検索処理
    logger.info('ギフトショップ検索処理を開始します')
    GIFTSHOP_BASE_URL = "http://gift.nskdata.com/search/search.php?"
    SEARCH_PARAM = "&sub=検索"

    SITE_NAME = 'ギフトショップ'

    # ドライバー生成処理
    driver = scraip.create_driver()

    sheet_index = 1

    for search_dr in search_list:

        prefecture_param1 = "k1=" + search_dr.prefecture
        prefecture_param2 = "k2=" + search_dr.industry

        target_url = GIFTSHOP_BASE_URL + prefecture_param1 + \
            "&" + prefecture_param2 + SEARCH_PARAM

        output_excel_list = []

        output_list = scraip.search_giftshop(
            driver, target_url, search_dr.prefecture, search_dr.industry)
        output_excel_list.extend(output_list)

        excel.out_to_excel(output_excel_list, search_dr.industry +
                           "_" + search_dr.prefecture, search_dr, SITE_NAME, 1)

        # 辞書にシート名を登録
        global_giftshop_sheetname_dic[sheet_index] = search_dr.industry + \
            "_" + search_dr.prefecture
        sheet_index += 1

    # ブラウザを終了する。
    driver.quit()
Exemplo n.º 5
0
def mapion_main(search_list):

    # MAPIONキーワード検索処理
    logger.info('MAPION検索処理を開始します')
    MAPION_BASE_URL = "https://www.mapion.co.jp/s/"
    SEARCH_PARAM = "/t=spot/"

    SITE_NAME = 'MAPION'

    # ドライバー生成処理
    driver = scraip.create_driver()

    sheet_index = 1

    for search_dr in search_list:

        query_param = "q=" + search_dr.industry + "%20" + search_dr.prefecture

        target_url = MAPION_BASE_URL + query_param + SEARCH_PARAM

        output_excel_list = []

        output_list = scraip.search_mapion(
            driver, target_url, search_dr.prefecture, search_dr.industry)
        output_excel_list.extend(output_list)

        excel.out_to_excel(output_excel_list, search_dr.industry +
                           "_" + search_dr.prefecture, search_dr, SITE_NAME, 3)

        # 辞書にシート名を登録
        global_mapion_sheetname_dic[sheet_index] = search_dr.industry + \
            "_" + search_dr.prefecture
        sheet_index += 1

    # ブラウザを終了する。
    driver.quit()
Exemplo n.º 6
0
def navitime_main(search_list):

    # NAVITIMEキーワード検索処理
    logger.info('NAVITIME検索処理を開始します')
    NAVITIME_BASE_URL = "https://www.navitime.co.jp/freeword/?"
    SEARCH_PARAM = "&type=spot&from=freeword.spotlist"

    SITE_NAME = 'NAVITIME'

    # ドライバー生成処理
    driver = scraip.create_driver()

    sheet_index = 1

    for search_dr in search_list:

        query_param = "keyword=" + search_dr.industry + "+" + search_dr.prefecture

        target_url = NAVITIME_BASE_URL + query_param + SEARCH_PARAM

        output_excel_list = []

        output_list = scraip.search_navitime(
            driver, target_url, search_dr.prefecture, search_dr.industry)
        output_excel_list.extend(output_list)

        excel.out_to_excel(output_excel_list, search_dr.industry +
                           "_" + search_dr.prefecture, search_dr, SITE_NAME, 2)

        # 辞書にシート名を登録
        global_navitime_sheetname_dic[sheet_index] = search_dr.industry + \
            "_" + search_dr.prefecture
        sheet_index += 1

    # ブラウザを終了する。
    driver.quit()
Exemplo n.º 7
0
def google_map_main(google_search_mode):
    # 検索対象リスト
    google_search_list = []
    # 検索成功した商品リスト
    google_success_list = []
    # 検索スキップした商品リスト
    google_skip_list = []

    logger.info('Googleマップ処理を開始します')
    logger.info('Googleマップ検索情報リストの読み込みを開始します')

    SITE_NAME = 'Googleマップ'

    # Googleマップの検索リストファイルの読み込み(全て欠損値がある行は読み込まない)
    search_df = settings.read_search_list(
        "./設定ファイル.xlsx", "Googleマップ設定", 0, "B:E", 0)

    for i in range(0, len(search_df)):

        _search = SearchInputInfo()
        _search.setFromExcelRow(search_df.iloc[i])

        # Googleマップの検索対象の市区町村リストの読み込み(全て欠損値がある行は読み込まない)
        if google_search_mode == 1:
            municipality_df = settings.read_search_list(
                "./設定ファイル.xlsx", "市区町村", 0, "B:C", 1)
            target_municipality_df = municipality_df[municipality_df['都道府県名'].str.contains(
                _search.prefecture)]
            target_municipality_list = target_municipality_df['市区町村名'].values.tolist(
            )
            _search.municipality_list = target_municipality_list

        # リストに追加
        google_search_list.append(_search)

    logger.info('Googleマップ検索情報リストの読み込みが完了しました')

    # Googleキーワード検索処理
    logger.info('Googleマップ検索処理を開始します')
    GOOGLE_MAP_URL = "https://www.google.co.jp/maps/?hl=ja"

    # ドライバー生成処理
    driver = scraip.create_driver()

    sheet_index = 1

    for search_dr in google_search_list:

        output_excel_list = []

        if google_search_mode == 1:
            for search_municipality in search_dr.municipality_list:
                # キーワード作成
                search_keyword = search_dr.industry + " " + \
                    search_dr.prefecture + search_municipality
                output_list = map_scraip.search_google_map(
                    driver, search_keyword, GOOGLE_MAP_URL)
                if output_list or len(output_list):
                    output_excel_list.extend(output_list)
                    google_success_list.append(
                        search_dr.industry + "-" + search_dr.prefecture + "-" + search_municipality)
                else:
                    google_skip_list.append(
                        search_dr.industry + "-" + search_dr.prefecture + "-" + search_municipality)

        else:
            # キーワード作成
            search_keyword = search_dr.industry + " " + search_dr.prefecture
            output_list = map_scraip.search_google_map(
                driver, search_keyword, GOOGLE_MAP_URL)
            if output_list or len(output_list):
                output_excel_list.extend(output_list)
                google_success_list.append(
                    search_dr.industry + "-" + search_dr.prefecture)
            else:
                google_skip_list.append(
                    search_dr.industry + "-" + search_dr.prefecture)

        excel.out_to_excel(output_excel_list, search_dr.industry +
                           "_" + search_dr.prefecture, search_dr, SITE_NAME, 7)

        # 辞書にシート名を登録
        global_google_sheetname_dic[sheet_index] = search_dr.industry + \
            "_" + search_dr.prefecture
        sheet_index += 1

    # ブラウザを終了する。
    driver.quit()
Exemplo n.º 8
0
def goo_map_main():
    # 検索対象リスト
    goo_search_list = []
    # 検索成功した商品リスト
    goo_success_list = []
    # 検索スキップした商品リスト
    goo_skip_list = []

    logger.info('処理を開始します')
    logger.info('検索情報リストの読み込みを開始します')

    SITE_NAME = 'goo地図'

    # goo地図検索リストファイルの読み込み(全て欠損値がある行は読み込まない)
    search_df = settings.read_search_list(
        "./設定ファイル.xlsx", "goo地図設定", 0, "B:E", 0)

    for i in range(0, len(search_df)):

        _search = SearchInputInfo()
        _search.industry = search_df.iloc[i][0]
        _search.area = search_df.iloc[i][1]
        _search.prefecture = search_df.iloc[i][2]
        _search.exclusion_genre = search_df.iloc[i][3]

        # リストに追加
        goo_search_list.append(_search)

    logger.info('検索情報リストの読み込みが完了しました')

    # goo地図キーワード検索処理
    logger.info('検索処理を開始します')
    GOO_MAP_URL = "https://map.goo.ne.jp"

    # ドライバー生成処理
    driver = scraip.create_driver()

    sheet_index = 1

    for search_dr in goo_search_list:

        output_excel_list = []

        # キーワード作成
        search_keyword = search_dr.industry + " " + search_dr.prefecture
        output_list = map_scraip.search_goo_map(
            driver, search_keyword, GOO_MAP_URL)
        if output_list or len(output_list):
            output_excel_list.extend(output_list)
            goo_success_list.append(
                search_dr.industry + "-" + search_dr.prefecture)
        else:
            goo_skip_list.append(search_dr.industry +
                                 "-" + search_dr.prefecture)

        excel.out_to_excel(output_excel_list, search_dr.industry +
                           "_" + search_dr.prefecture, search_dr, SITE_NAME, 6)

        # 辞書にシート名を登録
        global_goo_sheetname_dic[sheet_index] = search_dr.industry + \
            "_" + search_dr.prefecture
        sheet_index += 1

    # ブラウザを終了する。
    driver.quit()