q6 commited on
Commit
3143c68
·
1 Parent(s): 3936122

hunt local

Browse files
Files changed (1) hide show
  1. Client/hunt.py +8 -2
Client/hunt.py CHANGED
@@ -4,6 +4,12 @@ import requests
4
  import io
5
  import zipfile
6
 
 
 
 
 
 
 
7
  img_base = 'https://i.pximg.net/img-original/img/'
8
 
9
  os.chdir(os.path.dirname(os.path.abspath(__file__)))
@@ -42,7 +48,7 @@ for index in indexs:
42
 
43
  print(f"Group: {group_name}\nFiltered: {len(filtered)}/{len(post_ids)}")
44
  if filtered:
45
- data = requests.post('https://q6-p.hf.space/pixif', json={"post_ids": filtered}).json()
46
 
47
  for post_id, url in data.items():
48
  txn.put(post_id.encode(), url.encode())
@@ -56,7 +62,7 @@ for index in indexs:
56
  to_download = {post_id: url for post_id, url in post_ids.items() if url not in blacklist and f"{post_id}.png" not in images_cache}
57
  print(f"Downloading {len(to_download)} images...")
58
  if to_download:
59
- images_zip = requests.post('https://q6-p.hf.space/download', json={'posts': to_download}, stream=True)
60
 
61
  print("Extracting images...")
62
  with io.BytesIO(images_zip.content) as f:
 
4
  import io
5
  import zipfile
6
 
7
+ local = False
8
+ if local:
9
+ endpoint = "http://127.0.0.1:7860"
10
+ else:
11
+ endpoint = "https://q6-p.hf.space"
12
+
13
  img_base = 'https://i.pximg.net/img-original/img/'
14
 
15
  os.chdir(os.path.dirname(os.path.abspath(__file__)))
 
48
 
49
  print(f"Group: {group_name}\nFiltered: {len(filtered)}/{len(post_ids)}")
50
  if filtered:
51
+ data = requests.post(f'{endpoint}/pixif', json={"post_ids": filtered}).json()
52
 
53
  for post_id, url in data.items():
54
  txn.put(post_id.encode(), url.encode())
 
62
  to_download = {post_id: url for post_id, url in post_ids.items() if url not in blacklist and f"{post_id}.png" not in images_cache}
63
  print(f"Downloading {len(to_download)} images...")
64
  if to_download:
65
+ images_zip = requests.post(f'{endpoint}/download', json={'posts': to_download}, stream=True)
66
 
67
  print("Extracting images...")
68
  with io.BytesIO(images_zip.content) as f: