Closed pyxin closed 4 years ago
from pathlib import Path
exercises = Path('./oauth-in-action-code-master/exercises')
for html in exercises.glob('**/*.html'):
xx = html.read_text()
xx = xx.replace("""<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>""","""<script src="https://cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>""")
xx = xx.replace("""<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>""","""<script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>""")
xx = xx.replace("""<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">""","""<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">""")
html.write_text(xx)
https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js 改成 https://cdn.bootcss.com/jquery/1.11.3/jquery.min.js