from concurrent.futures import ThreadPoolExecutor import requests from bs4 import BeautifulSoup def scraping(url): r = requests.get(url) if r.status_code == requests.codes.ok: soup = BeautifulSoup(r.content, 'html5lib') result = [] return (result) if __name__ == "__main__": urls = [] with ThreadPoolExecutor() as pool: result = [res for res in pool.map(scraping, urls)]