Moved everything to one file

master
Jef Roosens 2021-01-19 18:49:24 +01:00
parent 572426f3e3
commit 2518a0dfc2
2 changed files with 9 additions and 10 deletions

View File

@ -1,7 +0,0 @@
from scraper import Scraper, Category, Image
import sys
if __name__ == "__main__":
scraper = Scraper()
scraper.download(sys.argv[1])

View File

@ -1,10 +1,11 @@
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
import requests
import re
from urllib.parse import urlunsplit
from multiprocessing.dummy import Pool as ThreadPool from multiprocessing.dummy import Pool as ThreadPool
from urllib.parse import urlunsplit
import os import os
import re
import requests
import shutil import shutil
import sys
DOMAIN = "4kwallpapers.com" DOMAIN = "4kwallpapers.com"
@ -150,3 +151,8 @@ class Image(PageHandler):
with requests.get(self.image_url, stream=True) as r: with requests.get(self.image_url, stream=True) as r:
with open(os.path.join(dir_path, filename), "wb") as f: with open(os.path.join(dir_path, filename), "wb") as f:
shutil.copyfileobj(r.raw, f) shutil.copyfileobj(r.raw, f)
if __name__ == "__main__":
scraper = Scraper()
scraper.download(sys.argv[1])