Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

异步JS提取中的正则问题 #82

Open
0berry opened this issue Dec 8, 2023 · 0 comments
Open

异步JS提取中的正则问题 #82

0berry opened this issue Dec 8, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@0berry
Copy link

0berry commented Dec 8, 2023

lib/Recoversplit.py 中的jsCodeCompile方法

jsCodeFunc 测试数据为如下时,进入两个正则匹配
function js_compile(e){js_url="static/js/"+e+"."+{"chunk-06983978":"b0d3c4a1","chunk-2d0c8bf7":"071bb4c1","chunk-2d0cfaef":"b3ae4a29","chunk-2d0d0f79":"608eaa0e","chunk-2d0e4b0c":"4d8239f4","chunk-2d0e4e1f":"a3ce6cee","chunk-2d0e944c":"f6b43059","chunk-2d2104c6":"f0215a5f","chunk-2d226cab":"084119b8","chunk-2d229205":"94d86195","chunk-3fa7be4f":"41b57439","chunk-94d3c3c4":"50d75ee9","chunk-9ea35268":"e3a3a06a"}[e]+".js"
return js_url}

pattern1 = re.compile(r"\{(.*?)\:")
pattern2 = re.compile(r"\,(.*?)\:")
nameList1 = pattern1.findall(jsCode)
nameList2 = pattern2.findall(jsCode)

第一个正则提取时结果为
>>> nameList1
['js_url="static/js/"+e+"."+{"chunk-06983978"']

预期结果应该是
>>> re.findall(r"\{\"(.*?)\"\:",s)
['chunk-06983978']

@rtcatc rtcatc added the bug Something isn't working label Dec 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants