Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Quotefancy wallpapers scraper
import shutil
import os
import requests
from bs4 import BeautifulSoup
# USAGE: Add all the galleries that you want to be scraped in the list below
roots = ["",
# The root directory
root_dir = "quotefancy"
if not os.path.exists(root_dir):
for root in roots:
directory = os.path.join(root_dir, root.split('/')[-1])
if not os.path.exists(directory):
response = requests.get(root)
if response.status_code==200:
soup = BeautifulSoup(response.text)
hyperlinks = soup.find_all("a")
img_links = []
for link in hyperlinks:
img = link.find("img")
if img and img.get("data-original"):
if img_links:
count = 0
for linky in img_links:
name = linky.split("/")[-1]
res = requests.get(linky, stream=True)
path = os.path.join(directory, name)
with open(path, 'wb') as out_file:
shutil.copyfileobj(res.raw, out_file)
count += 1
del res
Copy link

I-am-Ammar-Khan commented Jul 28, 2022

How to extract Quote and person in text ?

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