Skip to content
This repository has been archived by the owner on Dec 14, 2023. It is now read-only.

Commit

Permalink
修改细节
Browse files Browse the repository at this point in the history
  • Loading branch information
hengshizhi committed Jul 5, 2023
1 parent 0291282 commit f3ee9ed
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
2 changes: 0 additions & 2 deletions mod/mods/content/AtRuntimeForTheFirstTime.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,3 @@ def AtRuntimeForTheFirstTime():
if('.ORStemplate.json' in k):
with open(v[1],'r',encoding='utf-8') as template:
ContentTemplates[k.replace('.ORStemplate.json','')] = json.loads(template.read())
# from mod.mods.content.urlapi import URL as _urlapi
# _urlapi
9 changes: 9 additions & 0 deletions mod/mods/content/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,22 @@
from mod.mods.content.AtRuntimeForTheFirstTime import AtRuntimeForTheFirstTime as AtRuntimeForTheFirstTime
import json
from mod.mods.content.content import content as content_obj
from mod.mods.content.urlapi import URL as _urlapi
def main(api):
api['GetAllContentTemplates'] = GetAllContentTemplatesAPI
api['NewContent'] = NewContent
api['change'] = change
api['ZUOzhEreadApi'] = ZUOzhEreadApi
api['urlapi'] = urlapi
return api

def urlapi(get_or_post,EnableSession,rep,**para):
url = get_or_post('url')
if (url == None):rep('OK')
else:
obj = _urlapi()
return rep(obj.coverR(url))

def GetAllContentTemplatesAPI(get_or_post,EnableSession,rep,**para):
from mod.mods.content.ORSCFS import ContentTemplate as ContentTemplates
return rep(json.dumps(ContentTemplates))
Expand Down
8 changes: 1 addition & 7 deletions mod/mods/content/urlapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,14 @@ def change(self,new):
def coverR(self,url:str):
'''Apply the template and return the corresponding content'''
url = url.replace('https:/','').replace('https:/','')
print('url:',self.OT.data)
for k,v in self.OT.data.items():
o = v.split('<%^')[0]
n = v.split('^%>')[-1]
print('o:',o)
print('n:',n)
if (len(url[:(len(o))]) == len(o) and len(url[-len(n):]) == len(n)):
urlContent = url.replace(o,'').replace(n,'')
if (k == 'content'):
content = AliasSearchContent(urlContent)
content['content'] = ORSCFScontent(content['content']).html()
return json.dumps(content)

return ''

URL = URL()
print('aaaaaaaaaaaaaaa'+ URL.coverR('https://5915040c-b758-4982-8a45-0c2c2ede2290.html'))
return ''

0 comments on commit f3ee9ed

Please sign in to comment.