-
Notifications
You must be signed in to change notification settings - Fork 15
/
e2e.py
30 lines (24 loc) · 988 Bytes
/
e2e.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from pinscrape import scraper, Pinterest
import logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger()
keyword = "messi"
output_folder = "output"
proxies = {}
number_of_workers = 10
images_to_download = 1
def test_single_data():
details = scraper.scrape(keyword, output_folder, proxies, number_of_workers, images_to_download)
if details["isDownloaded"]:
print("\nDownloading completed !!")
print(f"\nTotal urls found: {len(details['extracted_urls'])}")
print(f"\nTotal images downloaded (including duplicate images): {len(details['urls_list'])}")
print(details)
else:
print("\nNothing to download !!", details)
assert len(details['extracted_urls']) > 0
def test_v2():
p = Pinterest()
images_url = p.search(keyword, images_to_download)
assert len(images_url) == images_to_download, p.errors
p.download(url_list=images_url, number_of_workers=number_of_workers, output_folder=output_folder)