Skip to content

Instantly share code, notes, and snippets.

@swdevbali
Created October 18, 2023 01:26
Show Gist options
  • Save swdevbali/381f1606352c99ec487812b7810d3a71 to your computer and use it in GitHub Desktop.
Save swdevbali/381f1606352c99ec487812b7810d3a71 to your computer and use it in GitHub Desktop.
Kode login
import scrapy
from bs4 import BeautifulSoup
class MySpider(scrapy.Spider):
name = 'my_spider'
start_urls = ['https://example.com']
def parse(self, response):
# Parse the HTML content with BeautifulSoup
soup = BeautifulSoup(response.text, 'html.parser')
# Extract data using BeautifulSoup
title = soup.title.text
# Yield data
yield {'title': title}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment