코딩으로 돈 벌 수 있는 가장 쉬운 방법 – 크롤링 부업


크롤링카툰

크롤링 하는 법

  1. 크롤링 해야할 사이트를 선택
  2. ChatGPT 혹은 claude를 엽니다
  3. 크롤링 하고 싶은 사이트로 가서 개발자 도구탭을 엽니다
  4. 주소창에 https://blog.codok.org/ 입력합니다
  5. 예제를 제 블로그의 포스팅 제목을 크롤링 하려고 합니다
  6. 개발자툴 스크린샷
  7. elements를 Copy해서 ChatGPT 혹은 claude에 paste합니다.
  8. “각 포스팅의 제목을 크롤링 하고 싶어, 코드 작성해줘” 라고 적어 넣습니다
  9. 코드를 붙여 넣고 실행합니다.
  10. 동작하지 않고 에러가 나오면 에러를 카피해서 ChatGPT 혹은 claude에 다시 paste합니다.
import requests
from bs4 import BeautifulSoup

# URL of the blog page you want to scrape
url = 'https://blog.codok.org/'

# Send a GET request to the URL
response = requests.get(url)

# Parse the HTML content using BeautifulSoup
soup = BeautifulSoup(response.content, 'html.parser')

# Find all article elements
articles = soup.find_all('article', class_='list-article')

# Extract and print the titles
for article in articles:
    title = article.find('h2', class_='entry-title').text.strip()
    print(title)