main
xiaowang 6 months ago
parent b5a7ddbaef
commit 8ac9461d7a

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="Flask">
<option name="enabled" value="true" />
</component>
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.venv" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="TemplatesService">
<option name="TEMPLATE_CONFIGURATION" value="Jinja2" />
<option name="TEMPLATE_FOLDERS">
<list>
<option value="$MODULE_DIR$/../flaskProject\templates" />
</list>
</option>
</component>
</module>

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Black">
<option name="sdkName" value="Python 3.8 (flaskProject)" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8 (flaskProject)" project-jdk-type="Python SDK" />
</project>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/flaskProject.iml" filepath="$PROJECT_DIR$/.idea/flaskProject.iml" />
</modules>
</component>
</project>

@ -0,0 +1,185 @@
from flask import Flask, render_template, request
import requests
from lxml import etree
import pymysql
app = Flask(__name__)
def getDB():
db = pymysql.connect(host='localhost',user='root',password='123456',database='douban')
return db
@app.route('/movies')
def movies():
db=getDB()
cursor=db.cursor()
sql="select film_name,director,actor,language,ranks,rating_num,summary,links from movies"
cursor.execute(sql)
data=cursor.fetchall()
datalist=[]
for item in data:
datalist.append(item)
cursor.close()
db.close()
return render_template('movies.html',movies=datalist)
@app.route('/index')
def index():
return render_template('index.html')
@app.route('/index1')
def index1():
uname=request.args.get('u')
psw=request.args.get('p')
if uname=="肖旺" and psw=="123":
return render_template('index.html')
else:
return render_template('regist.html')
@app.route('/login')
def login():
return render_template('login.html')
@app.route('/regist')
def regist():
return render_template('login.html')
@app.route('/get_nbadata')
def get_nbadata():
db=getDB()
cursor=db.cursor()
sql="select no,name,score,team,info from nba"
cursor.execute(sql)
data=cursor.fetchall()
datalist=[]
for item in data:
datalist.append(item)
cursor.close()
db.close()
return render_template('nba.html',nbadata=datalist)
'''@app.route('/get_nbadata')
def get_nbadata():
url='https://nba.hupu.com/stats/players'
header={'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0'}
res=requests.get(url,headers=header)
e=etree.HTML(res.text)
names=e.xpath('//table[@class="players_table"]//tr/td[2]/a/text()')
teams=e.xpath('//table[@class="players_table"]//tr/td[3]/a/text()')
nos=e.xpath('//table[@class="players_table"]//tr/td[1]/text()')
nos=nos[1::]
scores=e.xpath('//table[@class="players_table"]//tr/td[4]/text()')
scores=scores[1::]
infos=e.xpath('//table[@class="players_table"]//tr/td[2]/a/@href')
total_ls = []
infos_ls=[]
for no, name, team, score in zip(nos, names, teams, scores):
st1 = f"排名:{no} 姓名:{name} 队伍:{team} 得分:{score}"
total_ls.append(st1)
for info in infos:
infos_ls.append(info)
return render_template('nba.html',total_ls=total_ls,infos_ls=infos_ls)
@app.route('/music')
def get_music():
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36 Edg/123.0.0.0'
}
url = 'https://www.kugou.com/yy/html/rank.html'
res = requests.get(url=url, headers=headers)
e = etree.HTML(res.text)
music_names = e.xpath('//div[@id="rankWrap"]//ul/li/a/text()')
music_urls = e.xpath('//div[@id="rankWrap"]//ul/li/a/@href')
return render_template('music.html', music_urls=music_urls, music_names=music_names)
'''
@app.route('/music')
def music():
db=getDB()
cursor=db.cursor()
sql="select name,info from music"
cursor.execute(sql)
data=cursor.fetchall()
datalist=[]
for item in data:
datalist.append(item)
cursor.close()
db.close()
return render_template('music.html',datalist=datalist)
@app.route('/get_text')
def get_text():
headers= {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36'
}
url = 'https://www.biqg.cc/top/'
res = requests.get(url=url,headers=headers)
e = etree.HTML(res.text)
text_names=e.xpath('//div[@class="wrap rank"]//li/a/text()')
text_urls=e.xpath('//div[@class="wrap rank"]//li/a/@href')
text_authors=e.xpath('//div[@class="wrap rank"]//li/text()')
text_authors2 = []
for i in range(len(text_authors)):
x = str(text_authors[i]).strip('/').strip('\n').rstrip('\n ')
if x=='':
text_authors2.append('匿名作者')
else:
text_authors2.append(x)
print(text_authors2)
return render_template('text.html',text_names=text_names,text_authors2=text_authors2,text_urls=text_urls)
@app.route('/manh')
def get_url_info():
db = getDB()
cursor = db.cursor()
sql = "select names,ranks,renqi,shoucang,authors,urls from manh"
cursor.execute(sql)
data = cursor.fetchall()
datalist = []
for item in data:
datalist.append(item)
cursor.close()
db.close()
return render_template('manh.html', datalist=datalist)
@app.route('/qm')
def get_qm_info():
db = getDB()
cursor = db.cursor()
sql = "select names,ranks,authors,summarys,urls from xiaoshuo"
cursor.execute(sql)
data = cursor.fetchall()
datalist = []
for item in data:
datalist.append(item)
cursor.close()
db.close()
return render_template('qm.html', datalist=datalist)
@app.route('/about')
def about():
return render_template('about.html')
@app.route('/talk')
def talk():
return render_template('talk.html')
@app.route('/zhanghao')
def zhanghao():
return render_template('login.html')
if __name__=='__main__':
app.run()

@ -0,0 +1,71 @@
import pymysql
import requests
import re
from bs4 import BeautifulSoup
def getDB():
db = pymysql.connect(host='localhost',user='root',password='123456',database='douban')
return db
def Agent_info():
headers={
'Cookie':'118268"; bid=IO1Dg04kIm4; _vwo_uuid_v2=D1A645C6CFFBAF77D4DD98C62F188490B|754ea089c6c61f5af161e2912f2d4bee; __yadk_uid=NpVAgGKfMbTI28NFopWDALVWvzGMJt3S; _pk_id.100001.4cf6=095af3751c7a7a20.1681143032.; ap_v=0,6.0; __utmc=30149280; __utmc=223695111; dbcl2="279593631:HhdIjxDt0FA"; ck=XIW8; __utma=30149280.966668946.1681143033.1712632454.1712639313.6; __utmb=30149280.0.10.1712639313; __utmz=30149280.1712639313.6.2.utmcsr=accounts.douban.com|utmccn=(referral)|utmcmd=referral|utmcct=/; __utma=223695111.1690211447.1681143033.1712632454.1712639313.6; __utmb=223695111.0.10.1712639313; __utmz=223695111.1712639313.6.2.utmcsr=accounts.douban.com|utmccn=(referral)|utmcmd=referral|utmcct=/; _pk_ref.100001.4cf6=%5B%22%22%2C%22%22%2C1712639313%2C%22https%3A%2F%2Faccounts.douban.com%2F%22%5D; _pk_ses.100001.4cf6=1; push_noty_num=0; push_doumail_num=0; __gads=ID=d8a2141b0213474a-229414c42add00a6:T=1681143032:RT=1712639314:S=ALNI_Mb89dGhTs42z60R9TMxDscyQIzA8A; __gpi=UID=00000bf05307ad13:T=1681143032:RT=1712639314:S=ALNI_MbkC2b_Z_7nO1PL2HHsgHolhWs0iw; __eoi=ID=2f9ca57c63f42bd7:T=1712496871:RT=1712639314:S=AA-AfjbV9P_SdwHly0Xzv8gyJ7ZR',
'Host':'movie.douban.com',
'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36 Edg/123.0.0.0'
}
return headers
def get_url(url):
print("抓取网址",url)
headers=Agent_info()
request=requests.get(url,headers=headers)
soup=BeautifulSoup(request.text,'lxml')
pic=soup.find_all(attrs={'class' :'item'})
film_urls=[]
for x in pic:
href=x.a.get('href')
film_urls.append(href)
return film_urls
def get_url_info(film_url,id):
print("抓取网址", film_url)
headers = Agent_info()
request = requests.get(film_url, headers=headers)
soup = BeautifulSoup(request.text, 'lxml')
ranks=soup.find(attrs={'class':'top250-no'}).text.split('.')[1]
film_name=soup.find(attrs={'property':'v:itemreviewed'}).text
director=soup.find(attrs={'id':'info'}).text.split('\n')[1].split(':')[1].strip()
actor=soup.find(attrs={'id':'info'}).text.split('\n')[3].split(':')[1].strip().split('/')
actor= str(actor)
actor = pymysql.converters.escape_string(actor)
language=soup.find(attrs={'id':'info'}).text.split('\n')[6].split(':')[1].strip()
rating_num = soup.find(attrs={'property':'v:average'}).text
summary = soup.find(attrs={'property': 'v:summary'}).text
summary=pymysql.converters.escape_string(summary)
sql = 'insert into movies (film_name,director,actor,language,ranks,rating_num,summary,links) values ("{}","{}","{}","{}","{}","{}","{}","{}")'.format(film_name,director,actor,language,ranks,rating_num,summary,film_url)
db = getDB()
cursor = db.cursor()
try:
cursor.execute(sql)
cursor.execute('insert into moviehash(movieid) values ("{}")'.format(id))
db.commit()
except Exception as e:
print(e)
db.rollback()
cursor.close()
db.close()
if __name__ == '__main__':
print("开始抓取")
db=getDB()
cursor=db.cursor()
for i in range(0,50,25):
film_urls= get_url("https://movie.douban.com/top250?start="+str(i)+"&filter=")
for film_url in range(len(film_urls)):
id=re.search('\d\d+',film_urls[film_url]).group()
sql='select movieid from moviehash where movieid="{}";'.format(id)
cursor.execute(sql)
data=cursor.fetchall()
if not data:
get_url_info(film_urls[film_url],id)

@ -0,0 +1,35 @@
import pymysql
import requests
from lxml import etree
def getDB():
db = pymysql.connect(host='localhost',user='root',password='123456',database='douban')
return db
def Agent_info():
headers={
'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36 Edg/123.0.0.0'
}
return headers
def get_url_info(music_url):
print("抓取网址", music_url)
music_url = 'https://www.kugou.com/yy/html/rank.html'
headers = Agent_info()
res = requests.get(url=music_url, headers=headers)
e = etree.HTML(res.text)
music_singer =e.xpath('//div[@id="rankWrap"]//ul/li/a/@title')
music_urls = e.xpath('//div[@id="rankWrap"]//ul/li/a/@href')
for i in range(len(music_singer)):
sql = 'insert into music (name,info) values ("{}","{}")'.format(music_singer[i],music_urls[i])
db = getDB()
cursor = db.cursor()
try:
cursor.execute(sql)
db.commit()
except Exception as e:
print(e)
db.rollback()
result = cursor.fetchone()
cursor.close()
db.close()
if __name__ == '__main__':
get_url_info(music_url= 'https://www.kugou.com/yy/html/rank.html')

@ -0,0 +1,38 @@
import pymysql
import requests
from lxml import etree
def getDB():
db = pymysql.connect(host='localhost',user='root',password='123456',database='douban')
return db
def Agent_info():
headers={
'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36 Edg/123.0.0.0'
}
return headers
def get_url_info(nba_url):
print("抓取网址", nba_url)
headers = Agent_info()
res = requests.get(nba_url, headers=headers)
e = etree.HTML(res.text)
names = e.xpath('//table[@class="players_table"]//tr/td[2]/a/text()')
teams = e.xpath('//table[@class="players_table"]//tr/td[3]/a/text()')
nos = e.xpath('//table[@class="players_table"]//tr/td[1]/text()')
nos = nos[1::]
scores = e.xpath('//table[@class="players_table"]//tr/td[4]/text()')
scores = scores[1::]
infos = e.xpath('//table[@class="players_table"]//tr/td[2]/a/@href')
for i in range(len(names)):
sql = 'insert into nba (no,name,team,score,info) values ("{}","{}","{}","{}","{}")'.format(nos[i],names[i],teams[i],scores[i],infos[i])
db = getDB()
cursor = db.cursor()
try:
cursor.execute(sql)
db.commit()
except Exception as e:
print(e)
db.rollback()
result = cursor.fetchone()
cursor.close()
db.close()
if __name__ == '__main__':
get_url_info(nba_url="https://nba.hupu.com/stats/players")

@ -0,0 +1,62 @@
import pymysql
import requests
from lxml import etree
import re
def getDB():
db = pymysql.connect(host='localhost',user='root',password='123456',database='douban')
return db
def Agent_info():
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36'
}
return headers
def get_url():
headers=Agent_info()
manh_url = 'https://www.qimao.com/paihang'
res = requests.get(url=manh_url, headers=headers)
htmldata=res.text
urls=re.findall('<a href="https://www.qimao.com/shuku/(\d+)/"',htmldata)
urls2=[]
for url in urls:
url="https://www.qimao.com/shuku/"+url+'/'
if url not in urls2:
urls2.append(url)
return urls2
def get_url_info(manh_url):
print("抓取网址", manh_url)
headers = Agent_info()
res = requests.get(manh_url, headers=headers)
e = etree.HTML(res.text)
ranks = e.xpath('//*[@id="__layout"]/div/div[3]/div/div/div/div[1]/div/div[1]/div[2]/div[1]/span[2]/text()')
ranks=str(ranks)[1:-1]
names = e.xpath('//*[@id="__layout"]/div/div[3]/div/div/div/div[1]/div/div[1]/div[2]/div[1]/span[1]/text()')
names =str( names)[1:-1]
authors = e.xpath('//*[@id="__layout"]/div/div[3]/div/div/div/div[1]/div/div[1]/div[2]/div[3]/span[1]/em/a/text()')
authors =str(authors)[4:-4]
summarys = e.xpath('//*[@id="__layout"]/div/div[3]/div/div/div/div[2]/div/div[2]/div[1]/div/div[1]/div[2]/p/text()')
sql = 'insert into xiaoshuo (names,ranks,authors,summarys,urls) values ("{}","{}","{}","{}","{}")'.format(names,ranks,authors,summarys,manh_url)
db = getDB()
cursor = db.cursor()
try:
cursor.execute(sql)
db.commit()
except Exception as e:
print(e)
db.rollback()
cursor.close()
db.close()
if __name__ == '__main__':
urls=get_url()
for url in urls:
get_url_info(url)

@ -0,0 +1,61 @@
import pymysql
import requests
from lxml import etree
def getDB():
db = pymysql.connect(host='localhost',user='root',password='123456',database='douban')
return db
def Agent_info():
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36 Edg/123.0.0.0'
}
return headers
def get_url():
headers=Agent_info()
manh_url = 'https://ac.qq.com/Rank/comicRank/type/top'
res = requests.get(url=manh_url, headers=headers)
e = etree.HTML(res.text)
hrefs = e.xpath('//div/ul/li/a/@href')
hrefs = hrefs[16:38]
for i in range(22):
hrefs[i] = "https://ac.qq.com/" + hrefs[i]
return hrefs
def get_url_info(manh_url):
print("抓取网址", manh_url)
headers = Agent_info()
res = requests.get(manh_url, headers=headers)
e = etree.HTML(res.text)
ranks = e.xpath('//*[@id="special_bg"]/div[3]/div/div/div[2]/div/div[2]/p/strong/text()')
ranks=str(ranks).strip('[').strip(']')
names = e.xpath('//*[@id="special_bg"]/div[3]/div/div/div[2]/div/div[1]/h2/strong/text()')
names=str(names).strip('[').strip(']')
authors = e.xpath('//*[@id="special_bg"]/div[3]/div/div/div[2]/div/p/span/em/text()')
authors1 = e.xpath('//*[@id="special_bg"]/div[3]/div/div/div[2]/div/p/span/em/text()')
authors2 = e.xpath('//*[@id="special_bg"]/div[3]/div/div/div[2]/div/p/span/em/text()')
authors0 = str(authors).split(',')[0]
authors0 = authors0[2:-5]
renqi = str(authors1).split(',')[1]
shoucang = str(authors2).split(',')[2]
shoucang=shoucang[:-1]
print(authors)
sql = 'insert into manh (names,ranks,renqi,shoucang,urls,authors) values ("{}","{}","{}","{}","{}","{}")'.format(names,ranks,renqi,shoucang,manh_url,authors0)
db = getDB()
cursor = db.cursor()
try:
cursor.execute(sql)
db.commit()
except Exception as e:
print(e)
db.rollback()
cursor.close()
db.close()
if __name__ == '__main__':
manh_urls = get_url()
for url in manh_urls:
get_url_info(url)

@ -0,0 +1,28 @@
body {
background-image: url(pic/about.jpg);
background-repeat:no-repeat ;
background-position:center;
background-size: cover;
background-attachment: fixed;
}
p{
text-align-all: center;
font-size: xx-large;
color: green;
}
.but{
width:300px;
min-height:40px;
display:block;
background-color:orange;
border:1px;
color:#fff;
padding:9px 14px;
font-size:15px;
line-height:normal;
border-radius:5px;
margin:20px;
}

@ -0,0 +1,107 @@
body {
background-image: url(pic/b6.jpg);
background-repeat:no-repeat ;
background-position:center;
background-size: cover;
background-attachment: fixed;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
margin: 0px auto;
height: 700px;
width: 800px;
border: 1px solid #00663300;
}
#navigator{
height:25px;
width:800px;
font-size:14px;
list-style-type:none;
}
#navigator li{
float:left;
width:190px;
height:25px;
}
#navigator li a{
color:#000000;
text-decoration:none;
padding-top:4px;
display:block;
width:131px;
height:22px;
text-align:center;
background-color:greenyellow;
margin-left:2px;
}
#navigator li a:hover{
background-color:#006633;
color:#FFFFFF;
}
#content {
height:auto;
width:800px;
}
.but{
width:300px;
min-height:40px;
display:block;
background-color:orange;
border:1px;
color:#fff;
padding:9px 14px;
font-size:15px;
line-height:normal;
border-radius:5px;
margin:20px;
}
.button:hover{
background-color:#006633;
color:#FFFFFF;
}
.movie {
height: 200px;
background-image: url("pic/b1.jpg");
background-repeat: no-repeat;
background-size: cover;
}
.text {
height: 200px;
background-image: url("pic/b2.jpg");
background-repeat: no-repeat;
background-size: cover;
}
.music {
height: 200px;
background-image: url("pic/b3.jpg");
background-repeat: no-repeat;
background-size: cover;
}
.nba {
height: 200px;
background-image: url("pic/b4.jpg");
background-repeat: no-repeat;
background-size: cover;
}
.manh {
height: 200px;
background-image: url("pic/b5.jpg");
background-repeat: no-repeat;
background-size: cover;
}
.qm {
height: 200px;
background-image: url("pic/b6.jpg");
background-repeat: no-repeat;
background-size: cover;
}

@ -0,0 +1,68 @@
@charset "UTF-8";
html{
width:100%;
height:100%;
overflow:hidden;
font-style:sans-serif;
}
body{
width:100%;
height:100%;
font-family:'Open Sans',sans-serif;
margin:0;
background-color:black;
}
#login{
position:absolute;
top:50%;
left:50%;
margin:-150px 0 0 -150px;
width:300px;
height:300px;
background-color:gray;
}
#login h1{
color:pink;
text-shadow:0 0 10px;
letter-spacing:1px;
text-align:center;
}
h1{
font-size:2em;
margin:0.67em 0;
}
input{
width:278px;
height:18px;
margin-bottom:10px;
outline:none;
padding:10px;
font-size:13px;
color:#fff;
text-shadow:1px 1px 1px;
border-top:1px;
border-right:1px;
border-left:1px;
border-bottom:1px;
border-radius:4px;
background-color:green;
}
.but{
width:300px;
min-height:20px;
display:block;
background-color:orange;
border:1px;
color:#fff;
padding:9px 14px;
font-size:15px;
line-height:normal;
border-radius:5px;
margin:0;
}

@ -0,0 +1,30 @@
body {
background-image: url(pic/manh.jpg);
background-repeat:no-repeat ;
background-position:center;
background-size: cover;
background-attachment: fixed;
}
a{
text-decoration: none;
color: darkslateblue;
}
h1{
text-align: center;
color:darkorchid;
}
.but{
width:300px;
min-height:40px;
display:block;
background-color:orange;
border:1px;
color:#fff;
padding:9px 14px;
font-size:15px;
line-height:normal;
border-radius:5px;
margin:20px;
}

@ -0,0 +1,27 @@
body{
background-color: bisque;
}
a{
text-decoration: none;
color: darkslateblue;
}
h1{
text-align: center;
color:darkorchid;
}
.but{
width:300px;
min-height:40px;
display:block;
background-color:orange;
border:1px;
color:#fff;
padding:9px 14px;
font-size:15px;
line-height:normal;
border-radius:5px;
margin:20px;
}

@ -0,0 +1,43 @@
a{
display:inline-block;
height: 29px;
float:right;
text-decoration: none;
margin:2px 5px
}
body {
background-image: url(pic/music.jpg);
background-repeat:no-repeat ;
background-position:center;
background-size: cover;
background-attachment: fixed;
}
h3{
color:red
}
a{
text-decoration: none;
color: darkslateblue;
}
h1{
text-align: center;
color:darkorchid;
}
.but{
width:300px;
min-height:40px;
display:block;
background-color:orange;
border:1px;
color:#fff;
padding:9px 14px;
font-size:15px;
line-height:normal;
border-radius:5px;
margin:20px;
}

@ -0,0 +1,38 @@
body {
background-image: url(pic/nba.jpg);
background-repeat:no-repeat ;
background-position:center;
background-size: cover;
background-attachment: fixed;
}
table{
border:1;
border-color: mediumvioletred;
}
a{
text-decoration: none;
color: darkslateblue;
}
h1{
text-align: center;
color:darkorchid;
}
.but{
width:300px;
min-height:40px;
display:block;
background-color:orange;
border:1px;
color:#fff;
padding:9px 14px;
font-size:15px;
line-height:normal;
border-radius:5px;
margin:20px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 463 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 506 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 559 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 914 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 987 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 477 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 656 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 207 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 914 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 987 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 447 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 353 KiB

@ -0,0 +1,12 @@
body {
background-image: url(pic/regist.jpg);
background-repeat:no-repeat ;
background-position:center;
background-size: cover;
background-attachment: fixed;
}
h1{
text-align: center;
}

@ -0,0 +1,30 @@
body {
background-image: url(pic/text.jpg);
background-repeat:no-repeat ;
background-position:center;
background-size: cover;
background-attachment: fixed;
}
a{
text-decoration: none;
color: darkslateblue;
}
h1{
text-align: center;
color:darkorchid;
}
.but{
width:300px;
min-height:40px;
display:block;
background-color:orange;
border:1px;
color:#fff;
padding:9px 14px;
font-size:15px;
line-height:normal;
border-radius:5px;
margin:20px;
}

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" type="text/css" href="static/about.css">
</head>
<body>
<div class="btn">
<form method="get" action="/index" >
<button class="but" type="submit" >回到主页</button>
</form>
<button class="but" type="submit">联系我们</button>
</div>
<p>&nbsp &nbsp&nbsp &nbsp 我们网站提供关于爬虫的相关信息和资源,旨在帮助用户了解爬虫技术并学习如何使用它们。爬虫是一种自动的程序,用于在互联网上收集和提取数据。它可以模拟人类的浏览行为,访问网页并抓取所需的信息。虫技术在数据分析、市场研究、争情报等领域具有广泛应用。在我们的网站上,用户可以找到有关爬虫的教程、指南实例代码。我们提供入门级别的教程,帮助初学者了解爬虫的基本原理和操作步骤。我们还提供高级教程,介绍更复杂的爬虫技术和应用场景。此外,我们还提供爬虫工具和架的推和评估。用户可以了解不同的爬虫工具,选择适合己需求的工具来开展爬虫项目。我们还提供爬虫实战案例和经验分享,让用户可以学习和借鉴成功的爬虫项目。我们的目标是帮助掌握爬虫技术,并将其应用于实际项目中。我们鼓励用户遵守法律法规和道德准则,在使用爬虫技术时保护个人隐私和网络安全。感谢您选择我们的网站,我们期待为您提供有关爬虫的知识和资源。如有任何问题或需求,请随时联系我们。</p>
</body>
</html>

@ -0,0 +1,54 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>index</title>
<link rel="stylesheet" type="text/css" href="static/index.css">
</head>
<body>
<div id="content" >
<embed src="static/pic/bgmusic.ogg" preload="auto" autostart="true" loop="true" hidden="true">
<div id="navigator">
<ul id="navigator">
<li><a href="/about">关于</a></li>
<li><a href="/zhanghao">切换账号</a></li>
<li><a href="/talk">论坛</a></li>
<li><a href="#">帮助</a></li>
</ul>
</div>
<div class="movie">
<form method="get" action="/movies">
<button class="but" type="submit">点我看电影</button>
</form>
</div>
<div class="nba">
<form method="get" action="/get_nbadata">
<button class="but" type="submit">点我看NBA资讯</button>
</form>
</div>
<div class="music">
<form method="get" action="/music">
<button class="but" type="submit">点我听音乐</button>
</form>
</div>
<div class="text">
<form method="get" action="/get_text">
<button class="but" type="submit">点我看小说</button>
</form>
</div>
<div class="manh">
<form method="get" action="/manh">
<button class="but" type="submit">点我看漫画</button>
</form>
</div>
<div class="qm">
<form method="get" action="/qm">
<button class="but" type="submit">点我看七猫小说</button>
</form>
</div>
</div>
</body>
</html>

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>登录界面</title>
<link rel="stylesheet" type="text/css" href="static/login.css">
</head>
<body>
<div id="login">
<h1>阿肖的爬虫项目</h1>
<form method="get" action="/index1">
<input type="text" required="required" placeholder="用户名" name="u"></input>
<input type="password" required="required" placeholder="密码" name="p"></input>
<button class="but" type="submit">登录</button>
</form>
</div>
</body>
</html>

@ -0,0 +1,38 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" type="text/css" href="static/manh.css">
</head>
<body>
<div class="row">
<div class="col">
<h1 class="section-title">腾讯漫画</h1>
</div>
<form method="get" action="/index">
<button class="but" type="submit">回到主页</button>
</form>
</div>
<table class="table" border="1">
<tr>
<td >评分</td>
<td style="width:20%;">名称</td>
<td style="width:20%;">人气</td>
<td style="width:20%;">收藏</td>
<td style="width:20%;">作者</td>
<td >地址</td>
</tr>
{% for manh in datalist %}
<tr>
<td>{{ manh[1] }}</td>
<td>{{ manh[0] }}</td>
<td>{{ manh[2] }}</td>
<td>{{ manh[3] }}</td>
<td>{{ manh[4] }}</td>
<td><a href="{{ manh[5] }}" target="_blank">去腾讯动漫看</a></td>
</tr>
{% endfor %}
</table>
</body>
</html>

@ -0,0 +1,43 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" type="text/css" href="static/movies.css">
</head>
<body>
<div class="row">
<div class="col">
<h1 class="section-title">豆瓣电影top50排行榜</h1>
</div>
<form method="get" action="/index">
<button class="but" type="submit">回到主页</button>
</form>
</div>
<table class="table" border="1">
<tr>
<td >排名</td>
<td >评分</td>
<td style="width:5%;">电影中文名称</td>
<td style="width:5%;">导演</td>
<td style="width:5%;">语言</td>
<td style="width: 30%;">演员</td>
<td style="width: 50%;">简介</td>
<td style="width:5%;">播放地址</td>
</tr>
{% for movie in movies %}
<tr>
<td>{{ movie[4] }}</td>
<td>{{ movie[5] }}</td>
<td>{{ movie[0] }}</td>
<td>{{ movie[1] }}</td>
<td>{{ movie[3] }}</td>
<td>{{ movie[2] }}</td>
<td>{{ movie[6] }}</td>
<td><a href="{{ movie[7] }}" target="_blank">去豆瓣看</a></td>
</tr>
{% endfor %}
</table>
<embed src="static/pic/bgmusic.mp3" preload="auto" autostart="true" loop="true" hidden="true">
</body>
</html>

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" type="text/css" href="static/music.css">
</head>
<body>
<div class="row">
<div class="col">
<h1 class="section-title">酷狗音乐排行榜</h1>
</div>
<form method="get" action="/index">
<button class="but" type="submit">回到主页</button>
</form>
</div>
<table class="table" border="1">
<tr>
<td bgcolor="#f8f8ff">歌名</td>
<td style="width:20%;">播放地址</td>
</tr>
{% for music in datalist %}
<tr>
<td bgcolor="#d2691e">{{ music[0] }}</td>
<td bgcolor="#ff4500"><a href="{{ music[1] }}" target="_blank">播放</a></td>
</tr>
{% endfor %}
</table>
</body>
</html>

@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" type="text/css" href="static/nba.css">
</head>
<body>
<div class="row">
<div class="col">
<h1 class="section-title">NBA球员top50排行榜</h1>
</div>
<form method="get" action="/index">
<button class="but" type="submit">回到主页</button>
</form>
</div>
<table class="table" border="1">
<tr>
<td bgcolor="#ff4500">排名</td>
<td style="width:20%;" bgcolor="#ff4500">姓名</td>
<td style="width:20%;" bgcolor="#ff4500">得分</td>
<td style="width:20%;" bgcolor="#ff4500">队伍</td>
<td style="width:20%;" bgcolor="#ff4500">球员信息</td>
</tr>
{% for nba in nbadata %}
<tr>
<td>{{ nba[0] }}</td>
<td bgcolor="#f8f8ff">{{ nba[1] }}</td>
<td bgcolor="#f8f8ff">{{ nba[2] }}</td>
<td bgcolor="#f8f8ff">{{ nba[3] }}</td>
<td bgcolor="#f8f8ff"><a href="{{ nba[4] }}" target="_blank" >去虎扑网看</a></td>
</tr>
{% endfor %}
</table>
</body>
</html>

@ -0,0 +1,36 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" type="text/css" href="static/text.css">
</head>
<body>
<div class="row">
<div class="col">
<h1 class="section-title">七猫小说</h1>
</div>
<form method="get" action="/index">
<button class="but" type="submit">回到主页</button>
</form>
</div>
<table class="table" border="1">
<tr>
<td >评分</td>
<td style="width:20%;">名称</td>
<td style="width:20%;">作者</td>
<td style="width:20%;">简介</td>
<td >地址</td>
</tr>
{% for qm in datalist %}
<tr>
<td>{{ qm[1] }}</td>
<td>{{ qm[0] }}</td>
<td>{{ qm[2] }}</td>
<td>{{ qm[3] }}</td>
<td><a href="{{ qm[4] }}" target="_blank">去七猫小说看</a></td>
</tr>
{% endfor %}
</table>
</body>
</html>

@ -0,0 +1,36 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" type="text/css" href="static/regist.css">
<style>
.but{
width:300px;
min-height:50px;
display:block;
background-color:orange;
border:1px;
color:#fff;
font-size:15px;
line-height:normal;
border-radius:5px;
margin-left:auto;
margin-right: auto;
}
h1{
color: deepskyblue;
font-size:2em;
margin:0.67em 0;
}
</style>
</head>
<body>
<form method="get" action="/login">
<h1>输入有误,请重新登录</h1>
<button class="but" type="submit">重新登录</button>
</form>
</body>
</html>

@ -0,0 +1,56 @@
<!DOCTYPE html>
<head>
<meta charset = "utf-8" />
<style>
body{
display: flex;
flex-direction: column;
align-items: center;
background-color: rgb(117, 113, 113);
color: white;
}
#main{
flex: 1;
width: 60%;
}
#typing{
flex: 1;
width: 60%;
height: 20vh;
border: red;
font-size:xx-large;
}
#commend{
flex: 1;
width: 80%;
}
#btn{
background-color: red;
}
p{
background-color:black;
}
</style>
</head>
<body>
<div id="main">
<h1>评论区</h1><hr>
<textarea id="typing">输入文字</textarea>
<button id="btn">发送评论</button>
<div id="commend"></div>
</div>
</body>
<script>
document.getElementById("btn").onclick=function(){send()};
function send(){
var g=new Date();
var value= document.getElementById("typing").value;
var p= document.createElement("p");
p.innerHTML="用户:"+value+'<hr>'+g.toUTCString();
document.getElementById("commend").prepend(p);
}
</script>
</html>

@ -0,0 +1,40 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" type="text/css" href="static/text.css">
</head>
<body>
<div class="row">
<div class="col">
<h1 class="section-title">笔趣阁小说</h1>
<form method="get" action="/index">
<button class="but" type="submit" >回到主页</button>
</form>
</div>
</div>
<table id="table1" style="float:left" border="1" bgcolor="#3cb371">
{% for name in text_names %}
<tr>
<td width="500px">{{ name }}</td>
</tr>
{% endfor %}
</table>
<table id="table3" style="float:left" border="1" bgcolor="#3cb371">
{% for author in text_authors2 %}
<tr>
<td width="500px">{{ author }}</td>
</tr>
{% endfor %}
</table>
<table id="table2" border="1" bgcolor="#faebd7">
{% for url in text_urls %}
<tr>
<td><a href="https://www.biqg.cc{{url}}">看小说</a></td>
</tr>
{% endfor %}
</table>
</body>
</html>

@ -0,0 +1,26 @@
import pymysql
import requests
from lxml import etree
import re
def get_news():
headers= {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36'
}
url = 'https://news.sina.com.cn/hotnews/#1'
res = requests.get(url=url,headers=headers)
e = res.json()
return e
if __name__ == '__main__':
urls=get_news()
print(urls)
Loading…
Cancel
Save