feat: 初始化导航网站项目
添加 Flask 导航站应用,包含 Docker 部署配置、SQLite 数据库、静态资源及 CI/CD 流水线。
这个提交包含在:
+45
@@ -0,0 +1,45 @@
|
||||
import requests
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
|
||||
|
||||
|
||||
def webstack():
|
||||
url = "http://webstack.cc/cn/"
|
||||
html = requests.get(url)
|
||||
# print(html.text)
|
||||
doc = html.text
|
||||
|
||||
soup = BeautifulSoup(doc,"html.parser")
|
||||
# print(soup.select('div.col-sm-3'))
|
||||
list = []
|
||||
sql = '''
|
||||
INSERT into library (name,summary,url,img)
|
||||
values ()
|
||||
'''
|
||||
for item_html in soup.select('div.col-sm-3'):
|
||||
# print(type(item_html))
|
||||
# print(item_html.select('div.label-info')[0].get("data-original-title"))
|
||||
# print("http://webstack.cc/"+item_html.select('img.img-circle')[0].get("data-src").replace("..",""))
|
||||
# print(item_html.select("a.overflowClip_1")[0].text.replace("\r\n","").replace(" ","").replace("\n",""))
|
||||
# print(item_html.select("p.overflowClip_2")[0].text)
|
||||
url = item_html.select('div.label-info')[0].get("data-original-title")
|
||||
img = "http://webstack.cc/"+item_html.select('img.img-circle')[0].get("data-src").replace("..","")
|
||||
title = item_html.select("a.overflowClip_1")[0].text.replace("\r\n","").replace(" ","").replace("\n","")
|
||||
summary = item_html.select("p.overflowClip_2")[0].text
|
||||
list.append({"title":title,"img":img,"url":url,"summary":summary})
|
||||
sql += "('"+title+"','"+summary+"','"+url+"','"+img+"'),"
|
||||
|
||||
print(len(list))
|
||||
print(sql)
|
||||
|
||||
sql = '''
|
||||
INSERT into library (cate,name,summary,url,img)
|
||||
values ()
|
||||
'''
|
||||
|
||||
with open('site.txt','r') as f:
|
||||
for line in f.readlines():
|
||||
print(line.split(","))
|
||||
sql += "('"+line.split(",")[0]+"','"+line.split(",")[1]+"','"+line.split(",")[2]+"','"+line.split(",")[4]+"','"+line.split(",")[3]+"'),"
|
||||
print(sql)
|
||||
在新工单中引用
屏蔽一个用户