requirements.txt 질문
해결됨
실전 프로젝트로 배우는 데이터 앱 만들기 with Python & Streamlit
안녕하세요 강의자료에는 requirements.txt가 안보이는 것 같은데 혹시 어디서 다운받을 수 있을까요? 버전 충돌이 발생해서요ㅠ
- python
- streamlit
173만명의 커뮤니티!! 함께 토론해봐요.
해결됨
실전 프로젝트로 배우는 데이터 앱 만들기 with Python & Streamlit
안녕하세요 강의자료에는 requirements.txt가 안보이는 것 같은데 혹시 어디서 다운받을 수 있을까요? 버전 충돌이 발생해서요ㅠ
미해결
파이썬 셀레니움 고급편 (python selenium - 크롤링, 크롤러)
User Agent Data 변경하는 법 강의에서 아래처럼 계속 오류가 생깁니다.. 코드는 동일하게 입력한 것 같은데.. 왜 그런 걸까요..? selenium.common.exceptions.InvalidArgumentException: Message: invalid argument: Invalid parameters (Session info: chrome=114.0.5735.110) import requests from user_agents import parse from selenium import webdriver from selenium.webdriver.chrome.options import Options import chromedriver_autoinstaller import random, time, os chromedriver_autoinstaller.install() def make_user_agent(ua, is_mobile): user_agent = parse(ua) model = user_agent.device.model platform = user_agent.os.family platform_version = user_agent.os.version_string + ".0.0" # 모바일 기준이다 version = user_agent.browser.version[0] print('version: ', version) ua_full_version = user_agent.browser.version_string print('ua_full_version: ', ua_full_version) architecture = "x86" print(platform, ' platform') if is_mobile: platform_info = "Linux armv8l" else: # Window platform_info = "Win32" RET_USER_AGENT = { "appVersion" : ua.replace("Mozilla/", ""), "userAgent" : ua, "platform" : f"{platform_info}", "acceptLanguage": "ko-KR, kr, en-US, en", "userAgentMetadata": { "brands" : [ {'brand': 'Not.A/Brand', 'version': '8'}, {'brand': 'Chromium', 'version': '114'}, {'brand': 'Google Chrome', 'version':'114'} ], "fullVersion": f"{ua_full_version}", "platform" : platform, "platformVersion": platform_version, "architecture" : architecture, "model": model, "mobile": is_mobile } } return RET_USER_AGENT pc_device = ["1920,1440","1920,1200","1920,1080","1600,1200","1600,900", "1536,864", "1440,1080","1440,900","1360,768" ] mo_device = [ "360,640", "360,740", "375,667", "375,812", "412,732", "412,846", "412,869", "412,892", "412,915" ] width, height = random.choice(pc_device).split(",") UA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36" options = Options() UA_Data = make_user_agent(UA, True) # 랜덤 쿠키 생성하기 # ** 1~100의 숫자 이름의 폴더 밑에 쿠키를 생성해서 저장한다 rand_user_folder = random.randrange(1, 100) userCookieDir = os.path.abspath(f"./cookies/{rand_user_folder }") if os.path.exists(userCookieDir) == False: print(userCookieDir, "폴더가 없어서 생성함") os.mkdir(userCookieDir) options.add_argument(f"user-data-dir={userCookieDir}") options.add_argument(f'--user-agent={UA}') options.add_argument(f'--window-size={width}, {height}') driver = webdriver.Chrome(options=options) driver.execute_cdp_cmd("Network.setUserAgentOverride", UA_Data) driver.get('https://google.com') driver.set_window_position(500, 500) input()
해결됨
따라하며 배우는 리액트 네이티브 기초
import {createBottomTabNavigator} from '@react-navigation/bottom-tabs'; import {createNativeStackNavigator} from '@react-navigation/native-stack'; import React from 'react'; import Home from './src/screens/Home'; import Search from './src/screens/Search'; import Profile from './src/screens/Profile'; import Activity from './src/screens/Activity'; import {NavigationContainer} from '@react-navigation/native'; import Status from './src/screens/Status'; import FriendProfile from './src/screens/FriendProfile'; import EditProfile from './src/screens/EditProfile'; const App = () => { const Stack = createNativeStackNavigator(); const Tab = createBottomTabNavigator(); const BottomTabScreen = () => { return ( <Tab.Navigator screenOptions={() => ({ tabBarHideOnKeyboard: true, // tabBarShowLabel: false, headerShown: false, tabBarStyle: { height: 70, }, })}> <Tab.Screen name="Home" component={Home} /> <Tab.Screen name="Search" component={Search} /> <Tab.Screen name="Activity" component={Activity} /> <Tab.Screen name="Profile" component={Profile} /> </Tab.Navigator> ); }; return ( <NavigationContainer> <Stack.Navigator screenOptions={{headerShown: false}}> <Stack.Screen name="Bottom" component={BottomTabScreen} /> <Stack.Screen name="Status" component={Status} /> <Stack.Screen name="FriendProfile" component={FriendProfile} /> <Stack.Screen name="EditProfile" component={EditProfile} /> </Stack.Navigator> </NavigationContainer> ); }; export default App; 강의 내용과 같이 App 컴포넌트 안에서 BottomTabScreen 컴포넌트를 선언하면 "Do not define components during render." 라는 경고문이 뜹니다. 그래서 아래와 같이 코드를 수정하였는데 App 컴포넌트 바깥에서 이렇게 선언해도 문제가 없는건가요? import {createBottomTabNavigator} from '@react-navigation/bottom-tabs'; import {createNativeStackNavigator} from '@react-navigation/native-stack'; import React from 'react'; import Home from './src/screens/Home'; import Search from './src/screens/Search'; import Profile from './src/screens/Profile'; import Activity from './src/screens/Activity'; import {NavigationContainer} from '@react-navigation/native'; import Status from './src/screens/Status'; import FriendProfile from './src/screens/FriendProfile'; import EditProfile from './src/screens/EditProfile'; const Stack = createNativeStackNavigator(); const Tab = createBottomTabNavigator(); const BottomTabScreen = () => { return ( <Tab.Navigator screenOptions={() => ({ tabBarHideOnKeyboard: true, // tabBarShowLabel: false, headerShown: false, tabBarStyle: { height: 70, }, })}> <Tab.Screen name="Home" component={Home} /> <Tab.Screen name="Search" component={Search} /> <Tab.Screen name="Activity" component={Activity} /> <Tab.Screen name="Profile" component={Profile} /> </Tab.Navigator> ); }; const App = () => { return ( <NavigationContainer> <Stack.Navigator screenOptions={{headerShown: false}}> <Stack.Screen name="Bottom" component={BottomTabScreen} /> <Stack.Screen name="Status" component={Status} /> <Stack.Screen name="FriendProfile" component={FriendProfile} /> <Stack.Screen name="EditProfile" component={EditProfile} /> </Stack.Navigator> </NavigationContainer> ); }; export default App;
미해결
[자동화 완전 정복] 인스타그램 휴대폰, 웹 자동화 프로그램 개발
안녕하세요! 선생님 혹시 에러가 나는데 봐주실 수 있을까요 ㅠㅠ 기본적으로 로그인부터 안됩니다 ㅠㅠ 에러 DevTools listening on ws://127.0.0.1:51221/devtools/browser/d2c4970f-37a8-4257-ad60-95407a9b0e45 cannot access local variable 'actions' where it is not associated with a value [에러] insta_web_login > 에러 발생 Traceback (most recent call last): File "c:\Users\문소희\Desktop\project\insta_auto\main.py", line 25, in <module> insta_web.insta_web_work(driver,keyword,count) File "c:\Users\문소희\Desktop\project\insta_auto\insta_web.py", line 117, in insta_web_work insta_web_link_extract(driver,count) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "c:\Users\문소희\Desktop\project\insta_auto\insta_web.py", line 75, in insta_web_link_extract WebDriverWait(driver, 10).until(EC.presence_of_element_located( File "C:\Users\문소희\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\support\wait.py", line 95, in until raise TimeoutException(message, screen, stacktrace) selenium.common.exceptions.TimeoutException: Message: Stacktrace: Backtrace: GetHandleVerifier [0x01086E73+48323] (No symbol) [0x01019661] (No symbol) [0x00F25308] (No symbol) [0x00F50B45] (No symbol) [0x00F50CDB] (No symbol) [0x00F7E3D2] (No symbol) [0x00F6A924] (No symbol) [0x00F7CAC2] (No symbol) [0x00F6A6D6] (No symbol) [0x00F4847C] (No symbol) [0x00F4957D] GetHandleVerifier [0x012EFD5D+2575277] GetHandleVerifier [0x0132F86E+2836158] GetHandleVerifier [0x013296DC+2811180] GetHandleVerifier [0x011141B0+626688] (No symbol) [0x0102314C] (No symbol) [0x0101F4B8] (No symbol) [0x0101F59B] (No symbol) [0x010121B7] BaseThreadInitThunk [0x76A100C9+25] RtlGetAppContainerNamedObjectPath [0x77907B4E+286] RtlGetAppContainerNamedObjectPath [0x77907B1E+238] main import time import uiautomator2 as u2 from selenium import webdriver import insta_web import insta_mobile serial = "ce031713db01712d02" device = u2.connect(serial) options = webdriver.ChromeOptions() options.add_argument('--user-agent= Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36') options.add_argument("--disanble-logging") options.add_experimental_option("useAutomationExtension",False) options.add_experimental_option('excludeSwitches',["enable-auttomation"]) driver = webdriver.Chrome(options=options) keyword_list = ["골린이", "골프사랑", "골프중독","골프스윙", "골프레슨"] for keyword in keyword_list: keyword = keyword.replace(" ","") count = 1000 insta_web.insta_web_work(driver,keyword,count) insta_mobile.insta_mobile_work(device) insta_web import time, data import chromedriver_autoinstaller chromedriver_autoinstaller.install() from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.keys import Keys from selenium.webdriver import ActionChains import pyperclip def insta_web_login(driver): try: driver.get("https://www.instagram.com/") # time.sleep(2) id_selector = "#loginForm > div > div:nth-child(1) > div > label > input" WebDriverWait(driver, 10).until(EC.presence_of_element_located( (By.CSS_SELECTOR, id_selector) )) id_input = driver.find_element(By.CSS_SELECTOR,id_selector) id_input.click() time.sleep(5) # ctrl + c 동작 pyperclip.copy(data.id) # ctrl + v 동작 actions.key_down(Keys.CONTROL).send_keys('v').key_up(Keys.CONTROL).perform() # id_input.send_keys(data.id) time.sleep(5) pw_selector = "#loginForm > div > div:nth-child(2) > div > label > input" pw_input = driver.find_element(By.CSS_SELECTOR,pw_selector) pw_input.click() time.sleep(5) actions = ActionChains(driver) # ctrl + c 동작 pyperclip.copy(data.pw) # ctrl + v 동작 actions.key_down(Keys.CONTROL).send_keys('v').key_up(Keys.CONTROL).perform() time.sleep(5) login_btn_selector = "#loginForm > div > div:nth-child(3) > button" login_btn = driver.find_element(By.CSS_SELECTOR, login_btn_selector) login_btn.click(5) except Exception as e: print(e) print('[에러] insta_web_login > 에러 발생') def insta_web_hashtag_search(driver,keyword): try: time.sleep(50) from urllib import parse keyword = "골프사랑" keyword = parse.quote(keyword) driver.get(f"https://www.instagram.com/explore/tags/{keyword}/") except Exception as e: print(e) print["[에러] insta_web_hashtag_search > 해시태그 검색중 에러 발생"] def insta_web_link_extract(driver, count=100): time.sleep(5) all_posting_sel = "div[id^='mount_0_0'] > div > div > div.x9f619.x1n2onr6.x1ja2u2z > div > div > div > div.x78zum5.xdt5ytf.x10cihs4.x1t2pt76.x1n2onr6.x1ja2u2z > div.x9f619.xnz67gz.x78zum5.x168nmei.x13lgxp2.x5pf9jr.xo71vjh.x1uhb9sk.x1plvlek.xryxfnj.x1c4vz4f.x2lah0s.x1q0g3np.xqjyukv.x1qjc9v5.x1oa3qoh.x1qughib > div.xh8yej3.x1gryazu.x10o80wk.x14k21rp.x1porb0y.x17snn68.x6osk4m > section > main > article > div:nth-child(3) > div" WebDriverWait(driver, 10).until(EC.presence_of_element_located( (By.CSS_SELECTOR, all_posting_sel) )) all_posting_box = driver.find_element(By.CSS_SELECTOR, all_posting_sel) time.sleep(5) '''링크 100개 추출''' links = [] while len(links) < count : try: for _ in range(6): driver.execute_script("window.scrollBy(0,600);") time.sleep(5) all_posting_box = driver.find_element(By.CSS_SELECTOR, all_posting_sel) posk_links = all_posting_box.find_elements(By.TAG_NAME,"a") for eachLink in posk_links: link = eachLink.get_attribute('href') links.append(link) links = set(links) links = list(links) except Exception as e: print(e) print("insta_web_link_extract > while 에러 발생") with open('links.txt',"a") as f: for link in links: # print(link) f.write(f"{link}\n") def insta_web_work(driver,keyword,count): insta_web_login(driver) insta_web_hashtag_search(driver, keyword) insta_web_link_extract(driver, count) insta_ mobile import time, data import chromedriver_autoinstaller chromedriver_autoinstaller.install() from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.keys import Keys from selenium.webdriver import ActionChains import pyperclip def insta_web_login(driver): try: driver.get("https://www.instagram.com/") # time.sleep(2) id_selector = "#loginForm > div > div:nth-child(1) > div > label > input" WebDriverWait(driver, 10).until(EC.presence_of_element_located( (By.CSS_SELECTOR, id_selector) )) id_input = driver.find_element(By.CSS_SELECTOR,id_selector) id_input.click() time.sleep(5) # ctrl + c 동작 pyperclip.copy(data.id) # ctrl + v 동작 actions.key_down(Keys.CONTROL).send_keys('v').key_up(Keys.CONTROL).perform() # id_input.send_keys(data.id) time.sleep(5) pw_selector = "#loginForm > div > div:nth-child(2) > div > label > input" pw_input = driver.find_element(By.CSS_SELECTOR,pw_selector) pw_input.click() time.sleep(5) actions = ActionChains(driver) # ctrl + c 동작 pyperclip.copy(data.pw) # ctrl + v 동작 actions.key_down(Keys.CONTROL).send_keys('v').key_up(Keys.CONTROL).perform() time.sleep(5) login_btn_selector = "#loginForm > div > div:nth-child(3) > button" login_btn = driver.find_element(By.CSS_SELECTOR, login_btn_selector) login_btn.click(5) except Exception as e: print(e) print('[에러] insta_web_login > 에러 발생') def insta_web_hashtag_search(driver,keyword): try: time.sleep(50) from urllib import parse keyword = "골프사랑" keyword = parse.quote(keyword) driver.get(f"https://www.instagram.com/explore/tags/{keyword}/") except Exception as e: print(e) print["[에러] insta_web_hashtag_search > 해시태그 검색중 에러 발생"] def insta_web_link_extract(driver, count=100): time.sleep(5) all_posting_sel = "div[id^='mount_0_0'] > div > div > div.x9f619.x1n2onr6.x1ja2u2z > div > div > div > div.x78zum5.xdt5ytf.x10cihs4.x1t2pt76.x1n2onr6.x1ja2u2z > div.x9f619.xnz67gz.x78zum5.x168nmei.x13lgxp2.x5pf9jr.xo71vjh.x1uhb9sk.x1plvlek.xryxfnj.x1c4vz4f.x2lah0s.x1q0g3np.xqjyukv.x1qjc9v5.x1oa3qoh.x1qughib > div.xh8yej3.x1gryazu.x10o80wk.x14k21rp.x1porb0y.x17snn68.x6osk4m > section > main > article > div:nth-child(3) > div" WebDriverWait(driver, 10).until(EC.presence_of_element_located( (By.CSS_SELECTOR, all_posting_sel) )) all_posting_box = driver.find_element(By.CSS_SELECTOR, all_posting_sel) time.sleep(5) '''링크 100개 추출''' links = [] while len(links) < count : try: for _ in range(6): driver.execute_script("window.scrollBy(0,600);") time.sleep(5) all_posting_box = driver.find_element(By.CSS_SELECTOR, all_posting_sel) posk_links = all_posting_box.find_elements(By.TAG_NAME,"a") for eachLink in posk_links: link = eachLink.get_attribute('href') links.append(link) links = set(links) links = list(links) except Exception as e: print(e) print("insta_web_link_extract > while 에러 발생") with open('links.txt',"a") as f: for link in links: # print(link) f.write(f"{link}\n") def insta_web_work(driver,keyword,count): insta_web_login(driver) insta_web_hashtag_search(driver, keyword) insta_web_link_extract(driver, count)
미해결
실습으로 끝장내는 웹 크롤링과 웹 페이지 자동화 & 실전 활용
"쿠팡 제품 검색 결과 크롤링" 강의를 응용해서 타오바오 사이트에서 해보려고 하는데, 자꾸 안돼서 아래와 같이 print(html) 했더니 뭔가 차단된거 같은 html 막 쭉 뜨네요 이럴때는 어떻게 해야하나요? req = requests.get(links, timeout=5, headers=headers, cookies=cookie) html = req.text soup = BeautifulSoup(html, "html.parser") print(html)
해결됨
한 입 크기로 잘라 먹는 리액트(React.js) : 기초부터 실전까지
비동기 함수를 왜 굳이 동기처럼 실행시키기 위해 await을 사용하는 건가요? 처음부터 함수를 만들때 동기로 만들면 되는거 아닌가요? 동기, 비동기가 잘이해가 안가네요..
미해결
실리콘밸리 엔지니어가 가르치는 파이썬 장고 웹프로그래밍
sqliteBrowser 사용하는 수업에서 db.sqlite3를 열려고 하니, database is locked 라는 메시지가 뜹니다. 그래서 ChatGPT나 Bard... Googling을 이용해봤지만, 저에게 해당될만한 내용이 없네요. 혹시 몰라 재부팅도 해봤습니다. 이거 DB부분만 지웠다가 다시 까는 방법이 있을까요? (makemigrations, migrate 부분)
미해결
[자동화 완전 정복] 인스타그램 휴대폰, 웹 자동화 프로그램 개발
섹션 6-3에서 for word in "멘트" << 이렇게 돌리면 댓글이 한글자씩 입력하고 작성됩니다. ex) 멘트 댓글1 : 멘 댓글2 : 트 if not device(text="이 게시물에 대한 댓글 기능이 제한되었습니다.").exists(): print("커멘드 작성 가능 exists") device(resourceId=" com.instagram.android :id/layout_comment_thread_edittext").click() for word in "안녕하세요!": device.send_keys(word) time.sleep(random.uniform(0.03,0.08)) time.sleep(5) device(resourceId=" com.instagram.android :id/layout_comment_thread_post_button_click_area").click() time.sleep(2) device.press ('back') time.sleep(2) device.press ('back') if not device(text="이 게시물에 대한 댓글 기능이 제한되었습니다.").exists(): print("커멘드 작성 가능 exists") device(resourceId="com.instagram.android:id/layout_comment_thread_edittext").click() for word in "안녕하세요!": device.send_keys(word) time.sleep(random.uniform(0.03,0.08)) time.sleep(5) device(resourceId="com.instagram.android:id/layout_comment_thread_post_button_click_area").click() time.sleep(2) device.press('back') time.sleep(2) device.press('back')
해결됨
[퇴근후딴짓] 빅데이터 분석기사 실기 (작업형1,2,3)
안녕하세요 선생님 현재 모델링 및 평가(회귀)부분을 학습하고 있습니다. 코드를 따라가면서 실습을 진행하고 있는데, rmse 값이 선생님과 달라 질문 드립니다. 제가 알기로는 모델링을 하는 과정에서 예측한 값이 달라질 수 있고, 이에 따라 평가지표인 rmse 값이 다를 수 있다...라고 알고 있습니다. 그런데 값의 차이 뿐만이 아니라 baseline과 scaler 적용 결과가 좋은지 나쁜지가 달라 질문드립니다. 예를 들어, 선생님께서 하셨을때는 RandomForestRegressor의 baseline이 rmse값이 가장 좋았고(작았고), scaler를 적용했을 때 rmse가 커져서 scaler 적용은 하지 않는게 좋다~라는 내용의 실습이었는데 제가 했을 때는 baseline의 rmse보다 scaler를 적용했을 때의 rmse가 작아 scaler를 적용하는 것이 좋다..는 결론이 나옵니다. 질문을 정리하자면, 모델링을 하는 과정에서 선생님과 제가 실습한 예측값과 rmse가 다른게 맞는지 다른게 맞다 해도 scaler 적용여부 등을 바꿀 수 있을 정도로 예측값과 rmse가 달라질 수 있는지 (추가질문)달라지더라도 선생님 실습값 : 4728.xx 제 실습값 6025.174022213681 이정도로 달라질 수 있는지... (추가질문) 모델링 및 평가(회귀) 24:56에서 수험자는 알 수 없는 영역>y_test로 rmse로 구하시고 결과값이 17909.xx로 나왔는데 여기에서도 charges에 로그변환 한 이후기 떄문에 원래는 np.exp(pred)로 rmse를 구했어야 하는지 일 것 같습니다. 감사합니다.
미해결
따라하며 배우는 노드, 리액트 시리즈 - 쇼핑몰 사이트 만들기[전체 리뉴얼]
npm i -D postcss autoprefixer tailwind npx tailwindcss init -p 모두 작업을 마치고 /** @type {import('tailwindcss').Config} */ export default { content: [ "./index.html", "./src/**/*.{js,jsx,ts,tsx}" ], theme: { extend: {}, }, plugins: [], } index.css @tailwind base; @tailwind components; @tailwind utilities; npm run dev 를 돌리면, node:internal/process/promises:246 triggerUncaughtException(err, true /* fromPromise */); [Failed to load PostCSS config: Failed to load PostCSS config (searchPath: C:/WebStudy/WebDevelement/React/fullstack-react/front): [Error] Loading PostCSS Plugin failed: Cannot find module 'tailwindcss' 라는 오류가 뜹니다. 원인파악이 어려운데 문의드립니다!
미해결
파이썬 무료 강의 (활용편3) - 웹 스크래핑 (5시간)
webdriver의 find_element로 찾은 경우 .click()을 붙여주면 click이 되는데, soup으로 찾은 경우 .click()을 붙여주면 오류가 발생하네요. click을 하려면 find_element를 써야 할까요? soup으로 찾은 객체는 click을 할 수 없을까요?
미해결
[자동화 완전 정복] 인스타그램 휴대폰, 웹 자동화 프로그램 개발
로그인 > 해시태그 검색 까지는 작동되는데... 이후 스크롤부터 링크 추출까지 막혔습니다. 어떤 문제가 있는지 알수 있을까요? --------------------------------------------------------- import time import chromedriver_autoinstaller chromedriver_autoinstaller.install() from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support .ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.keys import Keys from selenium.webdriver import ActionChains driver = webdriver.Chrome () driver.get(" https://www.instagram.com/ ") # time.sleep(2) id_selector = "#loginForm > div > div:nth-child(1) > div > label > input" WebDriverWait(driver, 10).until(EC.presence_of_element_located( (By.CSS_SELECTOR, id_selector) )) import mdata id_input = driver.find_element(By.CSS_SELECTOR,id_selector) id_input.send_keys( mdata.id ) time.sleep(1) pw_selector = "#loginForm > div > div:nth-child(2) > div > label > input" pw_input = driver.find_element(By.CSS_SELECTOR,pw_selector) pw_input.send_keys( mdata.pw ) time.sleep(1) login_btn_selector = "#loginForm > div > div:nth-child(3) > button" login_btn = driver.find_element(By.CSS_SELECTOR, login_btn_selector) login_btn.click() time.sleep(10) from urllib import parse keyword = "사업가" keyword = parse.quote(keyword) driver.get(f" https://www.instagram.com/explore/tags/{keyword}/ ") time.sleep(10) all_posting_sel = "div[id^='mount_0_0'} > div > div > div.x9f619.x1n2onr6.x1ja2u2z > div > div > div > div.x78zum5.xdt5ytf.x10cihs4.x1t2pt76.x1n2onr6.x1ja2u2z > div.x9f619.xnz67gz.x78zum5.x168nmei.x13lgxp2.x5pf9jr.xo71vjh.x1uhb9sk.x1plvlek.xryxfnj.x1c4vz4f.x2lah0s.x1q0g3np.xqjyukv.x1qjc9v5.x1oa3qoh.x1qughib > div.xh8yej3.x1gryazu.x10o80wk.x14k21rp.x1porb0y.x17snn68.x6osk4m > section > main > article > div:nth-child(3) > div" time.sleep(3) all_posting_box = driver.find_element(By.CSS_SELECTOR, all_posting_sel) time.sleep(3) '''링크 100개 추출''' links = [] while len(links) < 100 : for _ in range(6): driver.execute_script("window.scrollBy(0.600);") time.sleep(1) all_posting_box = driver.find_element(By.CSS_SELECTOR, all_posting_sel) posk_links = all_posting_box.find_elements(By.TAG_NAME,"a") for eachLink in posk_links: link = eachLink.get_attribute('href') links.append(link) links = set(links) links = list(links) for link in links: print(link) print("******") print(len(links), "개의 링크를 추출") input() ------------------------------------------------------ DevTools listening on ws://127.0.0.1:50287/devtools/browser/ed0f17f2-033d-4ba2-80b8-8f3d2f886171 Traceback (most recent call last): File "c:\Users\문소희\Desktop\project\insta_auto\insta_web.py", line 50, in <module> all_posting_box = driver.find_element(By.CSS_SELECTOR, all_posting_sel) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\문소희\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 831, in find_element return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\문소희\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 440, in execute self.error_handler.check_response(response) File "C:\Users\문소희\AppData\Local\Programs\Python\Python311\Lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 245, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.InvalidSelectorException: Message: invalid selector: An invalid or illegal selector was specified (Session info: chrome=113.0.5672.127) Stacktrace: Backtrace: GetHandleVerifier [0x005C6DF3+48691] (No symbol) [0x00558CC1] (No symbol) [0x00465068] (No symbol) [0x00468401] (No symbol) [0x00469641] (No symbol) [0x004696E0] (No symbol) [0x004900D0] (No symbol) [0x004906AB] (No symbol) [0x004BDD62] (No symbol) [0x004AA314] (No symbol) [0x004BC452] (No symbol) [0x004AA0C6] (No symbol) [0x00487E18] (No symbol) [0x00488F3D] GetHandleVerifier [0x00824EAA+2531050] GetHandleVerifier [0x00864B60+2792352] GetHandleVerifier [0x0085E6EC+2766636] GetHandleVerifier [0x00650820+612448] (No symbol) [0x005625BC] (No symbol) [0x0055E808] (No symbol) [0x0055E8EB] (No symbol) [0x00551C77] BaseThreadInitThunk [0x754900C9+25] RtlGetAppContainerNamedObjectPath [0x772E7B4E+286] RtlGetAppContainerNamedObjectPath [0x772E7B1E+238]
미해결
실습으로 끝장내는 웹 크롤링과 웹 페이지 자동화 & 실전 활용
선생님! 쿠팡정보 크롤링해서 웹사이트 만들었습니다 이렇게 유익한 강의 처음입니다!! 너무너무 감사해요 다름이 아니라 혹시 괜찮으시면 선생님과 만든 웹사이트에 쿠팡 파트너스 API 연동시키는 부분 강의로 찍어주실수 있는지요 아님 유튜브 영상이라도 부탁드려요 ㅠㅠㅠ 혼자 하려니까 API 주소를 어따 붙여넣기 해야하는지 감이 안잡히네요
미해결
[자동화 완전 정복] 인스타그램 휴대폰, 웹 자동화 프로그램 개발
강의에 보여주시는 부분과 다른 디자인으로 변경되었습니다. 비슷한 방법으로 해봐도 도저히 실행되지가 않네요..
미해결
[신규 개정판] 이것이 진짜 엑셀자동화다 - 기본편
네이버 메일 자동화 하는 강의를 듣는중 입니다. 네이버 화면이 변경되면서, 네이버 메일을 누르면 기존 구글 탭에서 네이버 메일로 가는게 아닌, 새로운 탭에 네이버 메일이 생성됩니다. 때문에, 메일쓰기 버튼을 클릭하라고 해도 NoSuchElementException 에러가 발생합니다. (이게 네이버 메일이 새 탭에서 생성되었기 때문이라는 것을 알게되기 까지 정말 힘들었습니다...) 파이썬으로 제어하는 창을 활성화 탭으로 옮기도록 driver.switch_to.window(driver.window_handles[-1]) 하면 가능하다는 건 알게되었습니다. 하지만, 내가 지금 바라보고 있는 탭이 어떤 탭인지 알 수 있는 방법이 무엇인지 알고싶습니다.
미해결
따라하며 배우는 리액트, 파이어베이스 - 채팅 어플리케이션 만들기[2023.12 리뉴얼]
next.js 환경에서 이 수업을 들을 수 있나요?
미해결
파이참으로 100~200 까지 3의 배수 인쇄하고, 그의 합 구하고 있는데 3의 배수 5개씩 인쇄는 잘 했는데 합계가 이상하게 구해집니다. 오류가 어디에 있는 건지 모르겠어요.. 고치면 오류떠서 아예 실행이 안되는데 ㅜㅜ for문이랑 while문 두개로 만들고 있는데 둘다 합계만 이상하게 뜹니다. ㅠ <<for문>> a = 0 hap = 0 count = 0 for a in range(100, 201) : if a % 3 == 0 : print(a) count = count + 1 if count % 5 == 0 : print() a = a + 1 hap = hap + a print("100~200 중 3의 배수의 합 : %d" % hap) <<while문>> a = 100 count = 0 hap = 0 while a <= 200 : if a % 3 == 0 : print(a) count = count + 1 if count % 5 == 0 : print() a = a + 1 hap = hap + a print("100~200 중 3의 배수의 합 : %d" % hap)
미해결
실습으로 끝장내는 웹 크롤링과 웹 페이지 자동화 & 실전 활용
안녕하세요. 강의 잘 듣고 있습니다. 네이버가 새로운 형태로 바뀌었는데 아주 간단한 것이 해결이 안되네요? 이유가 뭘까요? 기본구조는 이렇게 생겼습니다. <li class="shortcut_item"> <a href="mail.naver.com" class="link_service"> <span class="service_icon type_mail"> ::before ::after </span> <span class="service_name">메일</span> </a> </li> <li class="shortcut_item"> </li> 아래처럼 너무 단순한거라 생각했던 것을 못 가져오네요? 확인 부탁드려요~ service_name = soup.find(class_="service_name", string="메일") print(service_name) # None 출력이 안되네 이유가 뭘까나? print()
미해결
실습으로 끝장내는 웹 크롤링과 웹 페이지 자동화 & 실전 활용
강의를 잘 들었습니다. 완강이신지요? 너무 훌륭한 강의라서 좀더 이어졌으면 하는 간절한 바램입니다. 지금은 잘 이해하고 있다고 생각드는데 막상 실전에서 사용하려면 잘 안돼요.... 우선 복습부터 해야겠네요.... 감사합니다.
미해결
Selenium 기본 과정
상품고유번호(data-i)가 아닌 업체고유번호(data-ms)로 했을 때는 왜 작동이 안되는 걸까요? 2페이지에 분명히 있는데, 못찾고 계속 지나갑니다. 알려주시면 감사하겠습니다. from selenium import webdriver from selenium.webdriver.common.by import By import time import chromedriver_autoinstaller chromedriver_autoinstaller.install() 드라이버 = webdriver.Chrome() 진짜등수 = -1 등수 = -1 for 페이지인덱스 in range(1, 15): # 1. 페이지 방문 검색쿼리 = "em" 쇼핑링크 = f"https://msearch.shopping.naver.com/search/all?frm=NVSHPAG&origQuery={검색쿼리}&pagingIndex={페이지인덱스}&pagingSize=40&productSet=total&query={검색쿼리}&sort=rel&viewType=lst" 드라이버.get(쇼핑링크) time.sleep(2) # 2. 페이지 4-5번 내리기 for _ in range(4): 드라이버.execute_script("window.scrollBy(0,10000);") time.sleep(0.5) # 3. 타겟 상품이 노출되고 있는지 확인 # 4. 없다면 다음페이지로 이동 try: 타겟상품코드 = "4627652" 타겟상품_셀렉터 = f'a[data-ms="{타겟상품코드}"]' 찾은상품_엘리먼트 = 드라이버.find_element(By.CSS_SELECTOR, 타겟상품_셀렉터) 데이터 = 찾은상품_엘리먼트.get_attribute('data-nclick') 진짜등수 = 데이터.split(f"{타겟상품코드},r:")[-1].split(',')[0] 등수 = int(진짜등수) - (int(페이지인덱스) - 1) * 40 break except: print(f"{페이지인덱스} 페이지에서 타겟상품을 못찾음") #next page 방문해야 함 print(f"내상품의 진짜 등수는 : {진짜등수} 입니다.") print(f"내 상품은 {페이지인덱스} 페이지의 {등수}위에 노출되고 있습니다.") input()