반응형
기본적인 기능은 모두 구현되어 있습니다
좋아요 횟수나 반복 횟수등은 본인이 입맛대로 수정하시면 됩니다.
인스타에서 좋아요 200개 정도 연속적으로 누르면 봇으로 검열될 수 있으니 유의해주세요!
사용 방법 :
- account에 계정 정보 입력
- 프로그램 실행(otp있으명 otp 입력)
- 메인 화면 뜨면 좋아요 시작
-------------------------------------
크롬 드라이버는 직접 다운 받아주세요 (용량 문제로 업로드 불가)
다운로드 링크 >>
https://googlechromelabs.github.io/chrome-for-testing/#stable
Chrome for Testing availability
chrome-headless-shellmac-arm64https://storage.googleapis.com/chrome-for-testing-public/138.0.7204.15/mac-arm64/chrome-headless-shell-mac-arm64.zip200
googlechromelabs.github.io
자동 로그인 프로그램 다운 >>
해당 폴더의 구조는 아래와 같습니다.
📁 InstaLiker/
├── account.txt ← 첫줄: ID / 둘째줄: PW
├── chromedriver.exe ← 동일 폴더에 위치
├── insta_liker.exe ← pyinstaller로 만든 실행파일
import os
import sys
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
def resource_path(relative_path):
if getattr(sys, 'frozen', False):
base_path = os.path.dirname(sys.executable)
else:
base_path = os.path.dirname(os.path.abspath(__file__))
return os.path.join(base_path, relative_path)
# ✅ 설정
SCROLL_LIMIT = 10
LIKE_DELAY = 2.5
SCROLL_AMOUNT = 800
CHROMEDRIVER_PATH = resource_path('chromedriver.exe')
ACCOUNT_PATH = resource_path('account.txt')
# ✅ 계정정보 불러오기
try:
with open(ACCOUNT_PATH, 'r', encoding='utf-8') as f:
lines = f.readlines()
insta_id = lines[0].strip()
insta_pw = lines[1].strip()
except Exception as e:
print(f"❌ account.txt 로딩 실패: {e}")
sys.exit(1)
# ✅ 브라우저 실행
options = Options()
options.add_argument('--start-maximized')
options.add_argument('--disable-blink-features=AutomationControlled')
driver = webdriver.Chrome(service=Service(CHROMEDRIVER_PATH), options=options)
try:
# 1. 로그인
driver.get('https://www.instagram.com/accounts/login/')
WebDriverWait(driver, 15).until(EC.presence_of_element_located((By.NAME, "username")))
driver.find_element(By.NAME, 'username').send_keys(insta_id)
driver.find_element(By.NAME, 'password').send_keys(insta_pw)
driver.find_element(By.NAME, 'password').submit()
print("🔐 로그인 시도 중...")
# 2. 피드 로딩 대기
print("⏳ 피드 로딩 대기 중...")
WebDriverWait(driver, 20).until(
EC.presence_of_element_located((By.XPATH,
'//*[contains(@id,"mount")]/div/div/div[2]/div/div/div[1]/div[1]/div[1]/section/main/div[1]/div[2]/div/div[1]/div/div/div/div/div/div[2]/div/div/div/a'
))
)
print("✅ 피드 로딩 완료!")
for scroll_count in range(SCROLL_LIMIT):
print(f"🔄 스크롤 {scroll_count + 1}/{SCROLL_LIMIT}...")
# 좋아요 버튼 SVG 아이콘 (aria-label="좋아요")
like_svgs = driver.find_elements(
By.XPATH,
'//article//section//span//*[name()="svg"][@aria-label="좋아요"]'
)
liked_any = False
for svg in like_svgs:
try:
clickable = svg.find_element(By.XPATH, "./ancestor::*[3]") # div 또는 button
if clickable.is_displayed() and clickable.is_enabled():
clickable.click()
print("❤️ 좋아요 클릭")
time.sleep(LIKE_DELAY)
liked_any = True
break # 하나 클릭 후 스크롤
except Exception as e:
print("⚠️ 좋아요 클릭 실패:", e)
if not liked_any:
print("💤 좋아요 대상 없음. 다음으로 스크롤")
# 스크롤 아래로만 이동
driver.execute_script(f"window.scrollBy(0, {SCROLL_AMOUNT});")
time.sleep(3)
print("🎉 자동 좋아요 완료!")
except Exception as e:
print(f"❌ 실행 중 오류 발생: {e}")
finally:
input("⏹️ 종료하려면 Enter 키를 누르세요.")
driver.quit()
반응형
'정보 > 개발소프트웨어' 카테고리의 다른 글
GPT로 만든 던전앤파이터 자동 로그인 프로그램 (코드 공유/실행파일 공유) (0) | 2025.06.07 |
---|---|
Window Tail Program - Log Tailer 1.2v [프로그램/다운] (0) | 2019.03.14 |