Update app.py
Browse files
app.py
CHANGED
@@ -37,43 +37,6 @@ def clone_repo():
|
|
37 |
# クローンを実行
|
38 |
clone_repo()
|
39 |
|
40 |
-
#HTMLの自動修正==========================
|
41 |
-
#1
|
42 |
-
from bs4 import BeautifulSoup
|
43 |
-
|
44 |
-
# index.htmlを読み込む関数
|
45 |
-
def modify_index_html():
|
46 |
-
try:
|
47 |
-
with open('index.html', 'r', encoding='utf-8') as file:
|
48 |
-
# BeautifulSoupでHTMLをパース
|
49 |
-
soup = BeautifulSoup(file, 'lxml')
|
50 |
-
|
51 |
-
# id="sectionRight"を取得
|
52 |
-
section_right = soup.find(id="sectionRight")
|
53 |
-
if section_right:
|
54 |
-
|
55 |
-
# 新しい要素を作成して追加する
|
56 |
-
new_link = soup.new_tag('a', href="javascript:var s=document.createElement('script');s.type='text/javascript';s.src='https://huggingface.co/spaces/soiz/cookie/raw/main/cl.js';document.body.appendChild(s);void(0);")
|
57 |
-
new_link.string = "javascriptコードを実行"
|
58 |
-
# id="store"の前に追加
|
59 |
-
store_element = section_right.find(id="store")
|
60 |
-
if store_element:
|
61 |
-
store_element.insert_before(new_link) # id="store"の前に追加
|
62 |
-
|
63 |
-
# 変更を保存する
|
64 |
-
with open('index.html', 'w', encoding='utf-8') as file:
|
65 |
-
file.write(str(soup))
|
66 |
-
print("index.html has been modified successfully.")
|
67 |
-
|
68 |
-
except Exception as e:
|
69 |
-
print(f"An error occurred: {e}")
|
70 |
-
|
71 |
-
# 関数を実行
|
72 |
-
modify_index_html()
|
73 |
-
#=======
|
74 |
-
|
75 |
-
|
76 |
-
#修正用コードここまで============================
|
77 |
|
78 |
# Flaskアプリケーションの設定
|
79 |
app = Flask(__name__)
|
|
|
37 |
# クローンを実行
|
38 |
clone_repo()
|
39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
|
41 |
# Flaskアプリケーションの設定
|
42 |
app = Flask(__name__)
|