Moved everything to one file
parent
572426f3e3
commit
2518a0dfc2
|
@ -1,7 +0,0 @@
|
||||||
from scraper import Scraper, Category, Image
|
|
||||||
import sys
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
scraper = Scraper()
|
|
||||||
scraper.download(sys.argv[1])
|
|
12
scraper.py
12
scraper.py
|
@ -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])
|
||||||
|
|
Loading…
Reference in New Issue