20 lines
659 B
Python
20 lines
659 B
Python
def pixiv_handler(entries):
|
|
# 整理为JSON数组
|
|
pixiv_list = []
|
|
for entry in entries:
|
|
links = []
|
|
for i in entry['content']:
|
|
pattern = re.compile(
|
|
r'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+')
|
|
links = (re.findall(pattern, i['value']))
|
|
|
|
tag_pattern = re.compile(r'tags/(.*)/')
|
|
item = {id: entry['id'], 'title': entry['title'], 'link': links,
|
|
'author': entry['author'], 'tag': re.findall(tag_pattern, entry['source'].id)}
|
|
|
|
pixiv_list.append(item)
|
|
|
|
return pixiv_list
|
|
|
|
def pixiv_result_handler(list):
|
|
pass |