p / Client /Extract Pixiv /search.py
q6's picture
Search.py
d625ef0
raw
history blame contribute delete
685 Bytes
import os
import asyncio
import sys
import time
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from pixiv_api import search, cookies, headers
os.chdir(os.path.dirname(os.path.abspath(__file__)))
input_url = input("Enter the URL: ")
pages = 30
x=''
n=int(time.time()*100)
while n:
x=chr(97+n%26)+x
n//=26
async def main():
post_ids, filename = await search(input_url, pages, ai_only=False, real_only=False, cookies=cookies, headers=headers)
post_ids = list(dict.fromkeys(post_ids))
with open(f"../{x}_{filename}.txt", "w") as f:
f.write("\n".join(map(str, post_ids)))
if __name__ == "__main__":
asyncio.run(main())