Skip to content

Instantly share code, notes, and snippets.

@umangahuja1
Last active September 23, 2022 10:10
Show Gist options
  • Save umangahuja1/195dedc5d8069859f62c5e25d9c219a9 to your computer and use it in GitHub Desktop.
Save umangahuja1/195dedc5d8069859f62c5e25d9c219a9 to your computer and use it in GitHub Desktop.
from multiprocessing import Pool
import requests
from bs4 import BeautifulSoup
base_url = 'http://quotes.toscrape.com/page/'
all_urls = list()
def generate_urls():
for i in range(1,11):
all_urls.append(base_url + str(i))
def scrape(url):
res = requests.get(url)
print(res.status_code, res.url)
generate_urls()
p = Pool(10)
p.map(scrape, all_urls)
p.terminate()
p.join()
@BenjaminHoegh
Copy link

when does this even use bs4?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment