mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 14:22:55 +08:00
Update data_source.py
This commit is contained in:
parent
9fbc3b9d02
commit
bcc6df9d4d
@ -63,7 +63,6 @@ async def get_setu_urls(keyword: str, num: int = 1, r18: int = 0):
|
|||||||
text_list.append(f'title:{title}\nauthor:{author}\nPID:{pid}')
|
text_list.append(f'title:{title}\nauthor:{author}\nPID:{pid}')
|
||||||
img_url = str(img_url).replace('img-master', 'img-original').replace('_master1200', '')
|
img_url = str(img_url).replace('img-master', 'img-original').replace('_master1200', '')
|
||||||
txt_data += img_url + ','
|
txt_data += img_url + ','
|
||||||
if DOWNLOAD_SETU:
|
|
||||||
with open(TXT_PATH + file_name, 'w') as f:
|
with open(TXT_PATH + file_name, 'w') as f:
|
||||||
f.write(txt_data)
|
f.write(txt_data)
|
||||||
return urls, text_list, 200
|
return urls, text_list, 200
|
||||||
@ -100,6 +99,8 @@ async def search_online_setu(url: str):
|
|||||||
|
|
||||||
def get_setu(index: str):
|
def get_setu(index: str):
|
||||||
length = len(os.listdir(IMAGE_PATH + path))
|
length = len(os.listdir(IMAGE_PATH + path))
|
||||||
|
if length == 0:
|
||||||
|
return None, None
|
||||||
if not index:
|
if not index:
|
||||||
index = random.randint(0, length - 1)
|
index = random.randint(0, length - 1)
|
||||||
if is_number(index):
|
if is_number(index):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user