https://hoonstudio.tistory.com/303?category=882469 

 

[파이썬] 인스타그램 좋아요 봇 따라해보기

아래 출처에서 인스타그램 좋아요 봇 파이썬 코딩을 보고 따라해보았다 주의해야할 점은  - 인스타그램 2차 비밀번호 인증 해제  - 페이스북으로 로그인 하였다면, 인스타그램 비밀번호도 설정

hoonstudio.tistory.com

기존에 인스타 좋아요 봇을 어느정도 만들었는데, 노트북을 SSD로 교체하면서 기존 파일 백업이 제대로 안되었나보다.

그래서 HDD를 다시 꽂아서 복사하기 보다는 기존 내 포스팅을 참고해서 다시 코딩을 해보려고 한다.

어차피 파이썬도 안쓰는 동안 많이 잊어서 공부하는 겸사겸사 하려고 한다. (속으로는 백업의 중요성을 다시 깨달았다)

 

pycharm에서 pip도 실행할 수 있도록 pip를 설치하였다.

 

노란색 코멘트는 pip 21.3.1 버전 사용가능하다는 레코멘드.

chromedriver는 직접 더블클릭으로 설치가 아닌 selenium에서 바라보는 경로를 지정해주어야 한다.

그렇지 않으면 아래와 같이 에러가 나온다.

D:\05.Lab\02.python\20211214_insta_like_bot\main.py:24: DeprecationWarning: executable_path has been deprecated, please pass in a Service object
  driver = webdriver.Chrome(driver_path, options=options)
Traceback (most recent call last):
  File "D:\05.Lab\02.python\20211214_insta_like_bot\venv\lib\site-packages\selenium\webdriver\common\service.py", line 71, in start
    self.process = subprocess.Popen(cmd, env=self.env,
  File "C:\Users\move_\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 947, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\move_\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 1416, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] 지정된 파일을 찾을 수 없습니다

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\05.Lab\02.python\20211214_insta_like_bot\main.py", line 81, in <module>
    bot()
  File "D:\05.Lab\02.python\20211214_insta_like_bot\main.py", line 24, in bot
    driver = webdriver.Chrome(driver_path, options=options)
  File "D:\05.Lab\02.python\20211214_insta_like_bot\venv\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 70, in __init__
    super(WebDriver, self).__init__(DesiredCapabilities.CHROME['browserName'], "goog",
  File "D:\05.Lab\02.python\20211214_insta_like_bot\venv\lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 90, in __init__
    self.service.start()
  File "D:\05.Lab\02.python\20211214_insta_like_bot\venv\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start
    raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'chromedriver.exe' executable needs to be in PATH. Please see https://chromedriver.chromium.org/home


Process finished with exit code 1

나의 경우에는 main.py 파일이 있는 동일 경로에 chromedriver 파일을 복사해두었다.

그랬더니 예전에는 보지 못하였던 새로운 에러가 떨어졌다.

D:\05.Lab\02.python\20211214_insta_like_bot\main.py:24: DeprecationWarning: executable_path has been deprecated, please pass in a Service object
  driver = webdriver.Chrome(driver_path, options=options)
로그인중....
D:\05.Lab\02.python\20211214_insta_like_bot\main.py:35: DeprecationWarning: find_element_by_* commands are deprecated. Please use find_element() instead
  id_input = driver.find_element_by_xpath('//*[@id="loginForm"]/div/div[1]/div/label')
D:\05.Lab\02.python\20211214_insta_like_bot\main.py:40: DeprecationWarning: find_element_by_* commands are deprecated. Please use find_element() instead
  pw_input = driver.find_element_by_xpath('//*[@id="loginForm"]/div/div[2]/div/label')
D:\05.Lab\02.python\20211214_insta_like_bot\main.py:45: DeprecationWarning: find_element_by_* commands are deprecated. Please use find_element() instead
  login_btn = driver.find_element_by_xpath('//*[@id="loginForm"]/div/div[3]/button')
D:\05.Lab\02.python\20211214_insta_like_bot\main.py:56: DeprecationWarning: find_element_by_* commands are deprecated. Please use find_element() instead
  first_feed = driver.find_element_by_xpath('//*[@id="react-root"]/section/main/article/div[1]/div/div/div[1]/div[1]/a/div/div[2]')
Traceback (most recent call last):
  File "D:\05.Lab\02.python\20211214_insta_like_bot\main.py", line 81, in <module>
    bot()
  File "D:\05.Lab\02.python\20211214_insta_like_bot\main.py", line 56, in bot
    first_feed = driver.find_element_by_xpath('//*[@id="react-root"]/section/main/article/div[1]/div/div/div[1]/div[1]/a/div/div[2]')
  File "D:\05.Lab\02.python\20211214_insta_like_bot\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 520, in find_element_by_xpath
    return self.find_element(by=By.XPATH, value=xpath)
  File "D:\05.Lab\02.python\20211214_insta_like_bot\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 1244, in find_element
    return self.execute(Command.FIND_ELEMENT, {
  File "D:\05.Lab\02.python\20211214_insta_like_bot\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 422, in execute
    response = self.command_executor.execute(driver_command, params)
  File "D:\05.Lab\02.python\20211214_insta_like_bot\venv\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 421, in execute
    return self._request(command_info[0], url, body=data)
  File "D:\05.Lab\02.python\20211214_insta_like_bot\venv\lib\site-packages\selenium\webdriver\remote\remote_connection.py", line 443, in _request
    resp = self._conn.request(method, url, body=body, headers=headers)
  File "D:\05.Lab\02.python\20211214_insta_like_bot\venv\lib\site-packages\urllib3\request.py", line 78, in request
    return self.request_encode_body(
  File "D:\05.Lab\02.python\20211214_insta_like_bot\venv\lib\site-packages\urllib3\request.py", line 170, in request_encode_body
    return self.urlopen(method, url, **extra_kw)
  File "D:\05.Lab\02.python\20211214_insta_like_bot\venv\lib\site-packages\urllib3\poolmanager.py", line 375, in urlopen
    response = conn.urlopen(method, u.request_uri, **kw)
  File "D:\05.Lab\02.python\20211214_insta_like_bot\venv\lib\site-packages\urllib3\connectionpool.py", line 699, in urlopen
    httplib_response = self._make_request(
  File "D:\05.Lab\02.python\20211214_insta_like_bot\venv\lib\site-packages\urllib3\connectionpool.py", line 445, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "D:\05.Lab\02.python\20211214_insta_like_bot\venv\lib\site-packages\urllib3\connectionpool.py", line 440, in _make_request
    httplib_response = conn.getresponse()
  File "C:\Users\move_\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 1347, in getresponse
    response.begin()
  File "C:\Users\move_\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 307, in begin
    version, status, reason = self._read_status()
  File "C:\Users\move_\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 268, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "C:\Users\move_\AppData\Local\Programs\Python\Python39\lib\socket.py", line 704, in readinto
    return self._sock.recv_into(b)
KeyboardInterrupt

Process finished with exit code -1073741510 (0xC000013A: interrupted by Ctrl+C)

 

https://velog.io/@sangyeon217/deprecation-warning-executablepath-has-been-deprecated

 

DeprecationWarning: executable_path has been deprecated 해결하기

DeprecationWarning: executable_path has been deprecated 해결 방법에 대한 포스팅 입니다.

velog.io

 

아래처럼 취소선이 왜 생겼는지 보니 selenium 버전이 4버전이 되면서 라이브러리가 변경되서 warning도 뜨고 한다고 함. 그래서 기존대로 3버전으로 낮추는 작업을 진행함.

 

PS D:\05.Lab\02.python\20211214_insta_like_bot> pip uninstall selenium
Found existing installation: selenium 4.1.0
Uninstalling selenium-4.1.0:
  Would remove:
    d:\05.lab\02.python\20211214_insta_like_bot\venv\lib\site-packages\selenium-4.1.0.dist-info\*
    d:\05.lab\02.python\20211214_insta_like_bot\venv\lib\site-packages\selenium\*

pip를 3버젼대로 설치하고나니 취소선이 다시 없어짐

PS D:\05.Lab\02.python\20211214_insta_like_bot> pip3 install selenium=3.141
ERROR: Invalid requirement: 'selenium=3.141'
Hint: = is not a valid operator. Did you mean == ?
WARNING: You are using pip version 21.1.2; however, version 21.3.1 is available.
Collecting selenium==3.141
  Downloading selenium-3.141.0-py2.py3-none-any.whl (904 kB)
     |████████████████████████████████| 904 kB 6.4 MB/s
Requirement already satisfied: urllib3 in d:\05.lab\02.python\20211214_insta_like_bot\venv\lib\site-packages (from 
selenium==3.141) (1.26.7)
Installing collected packages: selenium
Successfully installed selenium-3.141.0
WARNING: You are using pip version 21.1.2; however, version 21.3.1 is available.
You should consider upgrading via the 'D:\05.Lab\02.python\20211214_insta_like_bot\venv\Scripts\python.exe -m pip i
nstall --upgrade pip' command.

너무 길어져서 다음 포스팅으로 이어서 진행하겠다.

Posted by 유영훈
,

[1강 : Orientation + Meeting People]

how do you spell your name?
how do you speel that?

I don't go to college on the weekend

I live in a city

Can I have your phone number, please?
It helps to spell your name.

It has been a long time. Are you going to this college now?
Yes, I am a medical students.
Nice talking to you. I've got to go. Good bye.

How can I help you?
I don't understand this.
Let's look at it together.

How old are you?
I am new to this college. => 처음 왔을때
I am new to this city.

[포인트]
Hi my name is ~
I'm from ~
I live in ~
How do you spell ~?
It's been a long time.
Nice talking with you.

-------------------------------------------
[2강 : My Things]
as a present
swipe : 밀다 [스와이프]

You can swipe left to see more pictures.
Swithch off your phone during this lesson, please. You can turn it on later.
I use my smartphone
Be careful! Don't ride your bike too fast!
Does my new necklace look good with this sweater?
to + 동사 : ~하기 위해서
 => I use my laptop to do homework
for + 명사 : ~를 위해서 
 => I bought this necklkace as a birthday present for my sister.

on the bus
travels 이동할때도 사용, 출퇴근 등
1 F 2 T 3 F 4 T 5 F 6 F 7 F 8 T
Ishmael has a bike
family cat

Push this button to switch on the phone.
I see. Yes, it's working now. 작동이 왼다.
Click at the top to open the map. 상단을 클릭해라.
That's better. 
Switch off your laptop now, please.
I didn't know.

swipe left to go back.
I always swipe the wrong way.
Type your email address here.
Here? Ok. Now what? 이제 어떻게 해요?

[포인트 정리]
My favorite thing is ~
~ is the most important thing I own. 내가 가지고 있는 것 중 가장 중요한 것
I love 동사 ing [to동사] 나는 ~하는 것을 좋아해요
I love taking a picture
I use 무엇 to 동사[for 명사]. 나는 ~하기 위해 ~을 사용해요
I use my smartphone to search for a nice brunch cafe.
I see. That's better.
Now what?

--------------------

[3강 : All about me (review) - 08:25]

I'm good at playing the acoustic and electronic guitar.
play [a sport] => play soccer
play [an instrument] => play the soccer (정관사 the를 붙여야 함)
she is good at it.

I'm good at 명사/동사ing.
I'm good at English.
My hobby is 명사/동사ing
My hobby is designing clothes.
I'm interested in 명사/동사ing.
I'm interested in protecting animals.









Posted by 유영훈
,

[진행시간 : 21분]
새벽 6시 00분에 시작 - 6시 21분 종료

[준비해본 것]
-

[도전해본 것]
-

[수업내용]
It would bring many tourist to my city and 

죄송하지만 다시 한번 말씀해주시겠어요?

I'm sorry, but could you say it again?


bring down the value



idiom [이디엄] => 관용구
ante up [엔티업] => 준비하다


[전화영어&복습 영상녹화]
- 안찍음

[다음 순서]
Prepare : 17page - 3paragraph (Book name : real talk 3)

[배운점/느낀점]
1. 수업 복기시간 : 10분 (수업 뒷부분만 한번더 들었다)


2. 녹음본 듣고 느낀 점 : 어제 목감기 약을 먹고 시작을 해서인지 컨디션이 좋아서 어제보다는 훨씬 대화가 잘 되었던 것 같다. 수업 중간에 배터리가 방전되서 수업이 끊기고 급하게 충전하면서 재통화하기는 하였지만, instrutor께서 잘 리드해주셔서 아무일도 없듯이 이어나갈수 있었다.

 

3. 인풋을 늘리기 위해 예전에 구매한 오픽책으로 공부하려고 한다.

Posted by 유영훈
,