Search.py
Browse files
Client/Extract Pixiv/search.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import asyncio
|
| 3 |
+
import sys
|
| 4 |
+
import time
|
| 5 |
+
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
|
| 6 |
+
from pixiv_api import search, cookies, headers
|
| 7 |
+
|
| 8 |
+
os.chdir(os.path.dirname(os.path.abspath(__file__)))
|
| 9 |
+
|
| 10 |
+
input_url = input("Enter the URL: ")
|
| 11 |
+
|
| 12 |
+
pages = 30
|
| 13 |
+
|
| 14 |
+
x=''
|
| 15 |
+
n=int(time.time()*100)
|
| 16 |
+
while n:
|
| 17 |
+
x=chr(97+n%26)+x
|
| 18 |
+
n//=26
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
async def main():
|
| 22 |
+
post_ids, filename = await search(input_url, pages, ai_only=False, real_only=False, cookies=cookies, headers=headers)
|
| 23 |
+
post_ids = list(dict.fromkeys(post_ids))
|
| 24 |
+
with open(f"../{x}_{filename}.txt", "w") as f:
|
| 25 |
+
f.write("\n".join(map(str, post_ids)))
|
| 26 |
+
|
| 27 |
+
if __name__ == "__main__":
|
| 28 |
+
asyncio.run(main())
|