{"id":10902,"date":"2021-02-26T17:08:58","date_gmt":"2021-02-26T08:08:58","guid":{"rendered":"http:\/\/www.gisdeveloper.co.kr\/?p=10902"},"modified":"2021-03-01T05:42:06","modified_gmt":"2021-02-28T20:42:06","slug":"%eb%8f%99%ec%a0%81-%ec%9b%b9-%ed%8e%98%ec%9d%b4%ec%a7%80%ec%97%90%ec%84%9c-%eb%8d%b0%ec%9d%b4%ed%84%b0-%ed%81%ac%eb%a1%a4%eb%a7%81-%ec%9e%90%eb%8f%99%ed%99%94","status":"publish","type":"post","link":"http:\/\/www.gisdeveloper.co.kr\/?p=10902","title":{"rendered":"\ub3d9\uc801 \uc6f9 \ud398\uc774\uc9c0\uc5d0\uc11c \ub370\uc774\ud130 \ud06c\ub864\ub9c1"},"content":{"rendered":"<p>\uc774 \uae00\uc740 \ub3d9\uc801 \uc6f9 \ud398\uc774\uc9c0\uc5d0\uc11c \uc8fc\uc18c \ub370\uc774\ud130\ub97c \ucde8\ub4dd\ud558\uae30 \uc704\ud55c \ud30c\uc774\uc36c \ucf54\ub4dc\ub97c \uc124\uba85\ud569\ub2c8\ub2e4.<\/p>\n<p>\ub3d9\uc801 \ud398\uc774\uc9c0\ub77c\ud568\uc740 \uc6f9 \ud398\uc774\uc9c0\uc5d0\uc11c \uc0ac\uc6a9\uc790\uc758 \ud074\ub9ad \ub4f1\uacfc \uac19\uc740 \uc870\uc791\uc744 \ud1b5\ud574 AJAX \ud638\ucd9c\uc774 \ubc1c\uc0dd\ud558\uc5ec \uadf8 \uacb0\uacfc\uac00 \ud398\uc774\uc9c0\uc758 \uc77c\ubd80\ubd84\uc5d0 \ubc18\uc601\ub418\uc5b4 \ubcc0\uacbd\ub418\ub294 \uac83\uc744 \uc758\ubbf8\ud569\ub2c8\ub2e4. \uc608\ub97c \ub4e4\uc5b4 \uc544\ub798\uc758 \ucee4\ud53c\ube48 \ud398\uc774\uc9c0\uc5d0\uc11c \ub9e4\uc7a5 \uc815\ubcf4\ub97c \ud655\uc778\ud558\uae30 \uc704\ud574 \uc0ac\uc6a9\uc790\ub294 \ub2e4\uc74c\uacfc \uac19\uc740 \uc808\ucc28\ub97c \ud1b5\ud574 \ub9e4\uc7a5\uc758 \uc774\ub984\uacfc \uc8fc\uc18c \uadf8\ub9ac\uace0 \uc804\ud654\ubc88\ud638\ub97c \ud655\uc778\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.gisdeveloper.co.kr\/wp-content\/uploads\/2021\/02\/coffee_bean.png\" alt=\"\" width=\"800\" class=\"aligncenter size-full wp-image-10904\" \/><\/p>\n<p>\uc704\uc758 \uadf8\ub9bc\uc744 \uae00\ub85c \uc124\uba85\ud558\uba74, \uba3c\uc800 \uc0ac\uc6a9\uc790\ub294 \uc815\ubcf4\ub97c \ud30c\uc545\ud560 \ub9e4\uc7a5\uc5d0 \ub300\ud55c &#8220;\uc790\uc138\ud788 \ubcf4\uae30&#8221; \ubc84\ud2bc\uc744 \ud074\ub9ad\ud558\uba74 \uc6f9\ube0c\ub77c\uc6b0\uc800\uac00 \uc5f0\uacb0\ub41c javascript \ucf54\ub4dc\ub97c \uc2e4\ud589\ud558\uc5ec \ud574\ub2f9 \ub9e4\uc7a5\uc758 \uc0c1\uc138 \uc815\ubcf4\uac00 \ub3d9\uc77c\ud55c \ud398\uc774\uc9c0\uc5d0 \ub3d9\uc801\uc73c\ub85c \ud45c\uc2dc\ub429\ub2c8\ub2e4.<\/p>\n<p>\uc774\ub7ec\ud55c \uc0ac\uc6a9\uc790\uc758 \uc870\uc791\uc744 \uc790\ub3d9\ud654\ud558\uae30 \uc704\ud574\uc11c\ub294 Selenium \ub77c\uc774\ube0c\ub7ec\ub9ac\ub97c \uc0ac\uc6a9\ud569\ub2c8\ub2e4. \uc774 \ub77c\uc774\ube0c\ub7ec\ub9ac\ub294 \uc6f9 \ube0c\ub77c\uc6b0\uc800\ub97c \ucf54\ub4dc\ub97c \ud1b5\ud574 \uc81c\uc5b4\ud558\uae30 \uc704\ud55c \ub77c\uc774\ube0c\ub7ec\ub9ac\uc774\uba70, \ub0b4\ubd80\uc801\uc73c\ub85c\ub294 Web Driver\ub77c\ub294 \ud504\ub85c\uadf8\ub7a8\uc744 \uc0ac\uc6a9\ud569\ub2c8\ub2e4. \uc544\uc6b8\ub7ec HTML \ud398\uc774\uc9c0\ub97c \ud574\uc11d\ud558\uc5ec \uc6d0\ud558\ub294 \uc815\ubcf4\ub97c \ucd94\ucd9c\ud560 \uc218 \uc788\ub294 BeautifulSoup \ub77c\uc774\ube0c\ub7ec\ub9ac\ub3c4 \ud544\uc694\ud569\ub2c8\ub2e4.<\/p>\n<p>BeautifulSoup\ub294 \ub2e4\uc74c\uacfc \uac19\uc740 pip \uba85\ub839\uc744 \ud1b5\ud574 \uc124\uce58\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n<p><code>pip install beautifulsoup4<\/code><\/p>\n<p>Selenium\uc740 \ub2e4\uc74c\uacfc \uac19\uc740 pip \uba85\ub839\uc73c\ub85c \uc124\uce58\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n<p><code>pip install selenium<\/code><\/p>\n<p>\uc5b8\uae09\ud588\ub4ef\uc774 selenium\uc740 Web Driver\uac00 \ud544\uc694\ud55c\ub370 Windows\uc758 Chrome\uc5d0 \ub300\ud55c \ub4dc\ub77c\uc774\ubc84\ub294 \ud604\uc7ac \uc2dc\uc810\uc5d0\uc11c \ub2e4\uc74c url\uc744 \ud1b5\ud574 \ub2e4\uc6b4\ub85c\ub4dc \ubc1b\uc744 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n<p><code>https:\/\/chromedriver.storage.googleapis.com\/index.html?path=88.0.4324.96\/<\/code><\/p>\n<p>\ub2e4\uc6b4\ub85c\ub4dc \ubc1b\uc740 \ud30c\uc77c\uba85\uc740 chromedriver_win32.zip\uc774\uba70 \uc555\ucd95\uc744 \ud480\uba74 chromedriver.exe\uac00 \uc0dd\uc131\ub429\ub2c8\ub2e4.<\/p>\n<p>\uc774\uc81c \uc900\ube44\uac00 \uc644\ub8cc\ub418\uc5c8\uc73c\ubbc0\ub85c \ucf54\ub4dc\ub97c \uc0b4\ud3b4\ubcf4\uaca0\uc2b5\ub2c8\ub2e4. \uba3c\uc800 \ud544\uc694\ud55c \ub77c\uc774\ube0c\ub7ec\ub9ac\ub97c import \ud569\ub2c8\ub2e4.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">\r\nfrom selenium import webdriver\r\nfrom selenium.webdriver.common.by import By\r\nfrom selenium.webdriver.support.ui import WebDriverWait\r\nfrom selenium.webdriver.support import expected_conditions\r\nfrom bs4 import BeautifulSoup\r\nimport pandas as pd\r\n<\/pre>\n<p>pandas\ub294 \ud06c\ub864\ub9c1\ud55c \ub370\uc774\ud130\ub97c csv \ud30c\uc77c\ub85c \uc800\uc7a5\ud558\uae30 \uc704\ud574 \uc0ac\uc6a9\ub429\ub2c8\ub2e4.<\/p>\n<p>\ub2e4\uc74c\uc73c\ub85c Web Driver\uc5d0 \ub300\ud55c \uac1d\uccb4\ub97c \uc0dd\uc131\ud569\ub2c8\ub2e4.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">\r\nwd = webdriver.Chrome('.\/WebDriver\/chromedriver.exe')\r\n<\/pre>\n<p>\uc774\uc81c \ub2e4\uc74c\uc758 \ucf54\ub4dc\ub85c \uc0ac\uc6a9\uc790\uc758 \ud074\ub9ad\uc744 \ud1b5\ud574 \ud638\ucd9c\ub418\ub294 \uc790\ubc14\uc2a4\ud06c\ub9bd\ud2b8 \ud568\uc218\ub97c Web Driver\ub97c \ud1b5\ud574 \uc790\ub3d9\ud654\ud569\ub2c8\ub2e4.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">\r\nresult = []\r\nfor i in range(1, 100):\r\n    try:\r\n        wd.get('https:\/\/www.coffeebeankorea.com\/store\/store.asp')\r\n        wd.execute_script('storePop2(%d)' %i)\r\n\r\n        element = WebDriverWait(wd, 2).until(\r\n            expected_conditions.presence_of_element_located((By.CLASS_NAME, \"store_table\")))\r\n\r\n        html = wd.page_source\r\n        soup = BeautifulSoup(html, 'html.parser')\r\n\r\n        store_name = soup.select('.store_txt > h2')[0].string\r\n\r\n        store_info = soup.select('table.store_table > tbody > tr > td')\r\n\r\n        store_address = list(store_info[2])[0]\r\n        store_phone = store_info[3].string\r\n\r\n        result.append([store_name, store_address,  store_phone])\r\n\r\n        print(f'{i} : {store_name} {store_address} {store_phone}')\r\n    except:\r\n        print(f'{i} : not exist')\r\n        continue\r\n\r\nwd.quit()\r\n\r\ndf = pd.DataFrame(result, columns = ('name', 'address', 'phone'))\r\ndf.to_csv('.\/CoffeeBean.csv', encoding='utf-8', mode='w', index=False)\r\n\r\nprint('Completed..')\r\n<\/pre>\n<p>\uc704\uc758 \ucf54\ub4dc\ub294 1-99\ubc88\uae4c\uc9c0\uc758 \uc778\uc790\uac12\uc5d0 \ub300\ud55c \uc790\ubc14\uc2a4\ud06c\ub9bd\ud2b8 \ud568\uc218(storePop2)\ub97c \ud638\ucd9c\ud558\uba70 \ud638\ucd9c\ub41c \uacb0\uacfc\uc778 html \ubb38\uc790\uc5f4\uc5d0\uc11c \ud544\uc694\ud55c \uc815\ubcf4\ub97c \ucd94\ucd9c\ud558\uc5ec CSV \ud30c\uc77c\ub85c \uc800\uc7a5\ud558\ub294 \ucf54\ub4dc\uc785\ub2c8\ub2e4. \uc2e4\ud589 \uacb0\uacfc\ub85c \uc800\uc7a5\ub418\ub294 CSV \ud30c\uc77c\uc758 \uc77c\ubd80 \ub0b4\uc6a9\uc740 \ub2e4\uc74c\uacfc \uac19\uc2b5\ub2c8\ub2e4.<\/p>\n<p><code>name,address,phone<br \/>\n\ud559\ub3d9\uc5ed DT\uc810,\uc11c\uc6b8\uc2dc \uac15\ub0a8\uad6c \ud559\ub3d9\ub85c 211 1\uce35  ,02-3444-9973<br \/>\n\uc218\uc11c\uc810,\uc11c\uc6b8\uc2dc \uac15\ub0a8\uad6c \uad11\ud3c9\ub85c 280 \uc218\uc11c\ub3d9 724\ud638  ,02-3412-2326<br \/>\n\ucc28\ubcd1\uc6d0\uc810,\uc11c\uc6b8\uc2dc \uac15\ub0a8\uad6c \ub17c\ud604\ub85c 566 \uac15\ub0a8\ucc28\ubcd1\uc6d01\uce35  ,02-538-7615<br \/>\n\uac15\ub0a8\ub300\ub85c\uc810,\uc11c\uc6b8\uc2dc \uc11c\ucd08\uad6c \uac15\ub0a8\ub300\ub85c 369 1\uce35  ,02-588-5778<br \/>\n\uba54\uac00\ubc15\uc2a4\uc810,\uc11c\uc6b8 \uac15\ub0a8\uad6c \uc0bc\uc131\ub3d9 159 \ucf54\uc5d1\uc2a4\ubab0 \uc9c0\ud5582\uce35  ,02-6002-3320<br \/>\n.<br \/>\n.<br \/>\n.<\/code><\/p>\n<p>\uc774\ub807\uac8c \ub9cc\ub4e4\uc5b4\uc9c4 \ud30c\uc77c\uc744 \ud1b5\ud574 \uc2e4\uc81c \uacf5\uac04 \uc88c\ud45c\ub85c \ubcc0\ud658\ud558\uae30 \uc704\ud55c \uc9c0\uc624\ucf54\ub529 \ud234\uc740 <a href='http:\/\/www.gisdeveloper.co.kr\/?p=4784'>Geocoder-Xr<\/a>\ub97c \uc0ac\uc6a9\ud558\uc2dc\ub294 \uac83\uc744 \ucd94\ucc9c\ub4dc\ub9bd\ub2c8\ub2e4.<\/p>\n<p>\ub05d\uc73c\ub85c \uc774 \uae00\uc740 <a href='https:\/\/www.hanbit.co.kr\/store\/books\/look.php?p_code=B5574348931'>&#8220;\ub370\uc774\ud130 \uacfc\ud559 \uae30\ubc18\uc758 \ud30c\uc774\uc36c \ube45\ub370\uc774\ud130 \ubd84\uc11d(\uc800\uc790 \uc774\uc9c0\uc601)&#8221;<\/a>\uc774\ub77c\ub294 \uc11c\uc801\uc744 \uc6d0\uc800\uc790\uc758 \ud5c8\ub77d \ud558\uc5d0 \ucc38\uc870\ud558\uc5ec \uc791\uc131\ud558\uc600\uc2b5\ub2c8\ub2e4.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.gisdeveloper.co.kr\/wp-content\/uploads\/2021\/02\/B5574348931_l.jpg\" alt=\"\" width=\"400\" height=\"500\" class=\"aligncenter size-full wp-image-10910\" \/><\/p>\n<p>\uc774 \ucc45\uc740 \ube45\ub370\uc774\ud130\uc5d0 \ub300\ud55c \uae4a\uc774 \uc788\ub294 \uc774\ud574\ub97c \ub3d5\ub294 \uc774\ub860\uc73c\ub85c \uc2dc\uc791\ud574 \ube45\ub370\uc774\ud130\ub97c \uc218\uc9d1\ud558\ub294 \uad6c\uccb4\uc801\uc778 \ubc29\ubc95\uacfc \uc774\ub807\uac8c \uc218\uc9d1\ub41c \ub370\uc774\ud130\ub97c \ud30c\uc774\uc36c \uc5b8\uc5b4\ub97c \uc774\uc6a9\ud558\uc5ec \ubd84\uc11d\ud558\uace0 \ubd84\uc11d \uacb0\uacfc\ub97c \ud6a8\uacfc\uc801\uc73c\ub85c \uc2dc\uac01\ud654\ud558\ub294 \ubc29\ubc95\uc744 \uad6c\uccb4\uc801\uc73c\ub85c \uc124\uba85\ud558\uace0 \uc788\uc2b5\ub2c8\ub2e4. \ud06c\ub864\ub9c1\uc5d0 \ub300\ud55c \uc88b\uc740 \uc608\uc81c\ub97c \uc774 \ube14\ub85c\uadf8\ub97c \ud1b5\ud574 \uacf5\uac1c\ud560 \uc218 \uc788\ub3c4\ub85d \ud5c8\ub77d\ud574\uc8fc\uc2e0 \uc774 \ucc45\uc758 \uc800\uc790\uc774\uc2e0 \uc774\uc9c0\uc601\ub2d8\uc5d0\uac8c \uac10\uc0ac\ub4dc\ub9bd\ub2c8\ub2e4.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\uc774 \uae00\uc740 \ub3d9\uc801 \uc6f9 \ud398\uc774\uc9c0\uc5d0\uc11c \uc8fc\uc18c \ub370\uc774\ud130\ub97c \ucde8\ub4dd\ud558\uae30 \uc704\ud55c \ud30c\uc774\uc36c \ucf54\ub4dc\ub97c \uc124\uba85\ud569\ub2c8\ub2e4. \ub3d9\uc801 \ud398\uc774\uc9c0\ub77c\ud568\uc740 \uc6f9 \ud398\uc774\uc9c0\uc5d0\uc11c \uc0ac\uc6a9\uc790\uc758 \ud074\ub9ad \ub4f1\uacfc \uac19\uc740 \uc870\uc791\uc744 \ud1b5\ud574 AJAX \ud638\ucd9c\uc774 \ubc1c\uc0dd\ud558\uc5ec \uadf8 \uacb0\uacfc\uac00 \ud398\uc774\uc9c0\uc758 \uc77c\ubd80\ubd84\uc5d0 \ubc18\uc601\ub418\uc5b4 \ubcc0\uacbd\ub418\ub294 \uac83\uc744 \uc758\ubbf8\ud569\ub2c8\ub2e4. \uc608\ub97c \ub4e4\uc5b4 \uc544\ub798\uc758 \ucee4\ud53c\ube48 \ud398\uc774\uc9c0\uc5d0\uc11c \ub9e4\uc7a5 \uc815\ubcf4\ub97c \ud655\uc778\ud558\uae30 \uc704\ud574 \uc0ac\uc6a9\uc790\ub294 \ub2e4\uc74c\uacfc \uac19\uc740 \uc808\ucc28\ub97c \ud1b5\ud574 \ub9e4\uc7a5\uc758 \uc774\ub984\uacfc \uc8fc\uc18c \uadf8\ub9ac\uace0 \uc804\ud654\ubc88\ud638\ub97c \ud655\uc778\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/www.gisdeveloper.co.kr\/?p=10902\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;\ub3d9\uc801 \uc6f9 \ud398\uc774\uc9c0\uc5d0\uc11c \ub370\uc774\ud130 \ud06c\ub864\ub9c1&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-10902","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/10902","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10902"}],"version-history":[{"count":11,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/10902\/revisions"}],"predecessor-version":[{"id":10909,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=\/wp\/v2\/posts\/10902\/revisions\/10909"}],"wp:attachment":[{"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10902"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10902"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.gisdeveloper.co.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10902"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}