Created
October 18, 2023 01:26
-
-
Save swdevbali/381f1606352c99ec487812b7810d3a71 to your computer and use it in GitHub Desktop.
Kode login
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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