Created
July 11, 2020 14:16
-
-
Save Abhayparashar31/689dcbac67afbab310fe19c87f3eab75 to your computer and use it in GitHub Desktop.
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
from bs4 import BeautifulSoup | |
import requests | |
def scrape(url): | |
res = requests.get(url) | |
print("\nSearching in Goodreads......") | |
soup = BeautifulSoup(res.text,'html.parser') | |
quote = soup.select('.quoteText') | |
length = len(quote) | |
for i in range(0,length): | |
quote = soup.select('.quoteText')[i].getText().strip() | |
quote = quote.replace("―","Author:") | |
quote = quote.replace("\n","") | |
print("\n"+quote) | |
for i in range(0,5): | |
url = f'https://www.goodreads.com/quotes?page={i}' | |
scrape(url) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment