parent
740aeadba4
commit
43479029d4
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,10 @@
|
|||||||
|
import pandas as pd
|
||||||
|
|
||||||
|
# 加载CSV文件
|
||||||
|
data = pd.read_csv('抖音评论.csv')
|
||||||
|
|
||||||
|
# 删除重复行
|
||||||
|
data_cleaned = data.drop_duplicates()
|
||||||
|
|
||||||
|
# 保存清理后的数据到新文件
|
||||||
|
data_cleaned.to_csv('抖音评论.csv', index=False)
|
Binary file not shown.
@ -0,0 +1,47 @@
|
|||||||
|
from tkinter import*
|
||||||
|
|
||||||
|
user_login ={'aaa':'123456', 'bbb':'888888', 'ccc':'333333', }
|
||||||
|
|
||||||
|
#定义登录次数
|
||||||
|
count =0
|
||||||
|
def login():
|
||||||
|
global count
|
||||||
|
username =entry_username.get ()
|
||||||
|
if username not in user_login:
|
||||||
|
label_message.config(text='账号错误!')
|
||||||
|
else:
|
||||||
|
password =entry_password.get ()
|
||||||
|
if (password ==user_login[username]):
|
||||||
|
label_message.config(text='登录成功!')
|
||||||
|
open_new_window()
|
||||||
|
else:
|
||||||
|
label_message.config(text='密码错误!还可以尝试{}次'.format (2 -coum))
|
||||||
|
count = count +1
|
||||||
|
if count ==3:
|
||||||
|
label_message.config(text='登录失败!')
|
||||||
|
btn_login.config(state="disabled")
|
||||||
|
def open_new_window():
|
||||||
|
# 创建一个新窗口
|
||||||
|
new_window = Toplevel(window)
|
||||||
|
new_window.title("登录成功")
|
||||||
|
new_window.geometry("300x200")
|
||||||
|
Label(new_window, text="欢迎进入新页面!").pack()
|
||||||
|
window =Tk()
|
||||||
|
window.title("用户登录")
|
||||||
|
window.geometry("300x200")
|
||||||
|
#创建标签和输入框
|
||||||
|
label_username=Label(window, text="账号:")
|
||||||
|
label_username.pack()
|
||||||
|
entry_username =Entry (window)
|
||||||
|
entry_username.pack ()
|
||||||
|
label_password=Label (window, text="密码:")
|
||||||
|
label_password.pack ()
|
||||||
|
entry_password = Entry(window, show='*')
|
||||||
|
entry_password.pack()
|
||||||
|
#创建登录按钮和消息提示标签
|
||||||
|
btn_login =Button (window, text="登录", command=login)
|
||||||
|
btn_login.pack()
|
||||||
|
label_message = Label (window, text ="")
|
||||||
|
label_message.pack()
|
||||||
|
#运行主循环
|
||||||
|
window.mainloop ()
|
@ -0,0 +1,30 @@
|
|||||||
|
from typing import List
|
||||||
|
|
||||||
|
import mysql
|
||||||
|
import mysql.connector
|
||||||
|
import csv
|
||||||
|
def hello():
|
||||||
|
db_config = {
|
||||||
|
'host': 'localhost',
|
||||||
|
'user': 'root',
|
||||||
|
'password': '12345678M',
|
||||||
|
'database': 'pinglun',
|
||||||
|
}
|
||||||
|
cnx = mysql.connector.connect(**db_config)
|
||||||
|
cursor = cnx.cursor()
|
||||||
|
# 读取CSV
|
||||||
|
with open('评论.csv', mode='r', encoding='utf-8') as file:
|
||||||
|
reader = csv.reader(file)
|
||||||
|
headers = next(reader, None)
|
||||||
|
if headers is not None: # 过表头
|
||||||
|
for row in reader:
|
||||||
|
sql = "INSERT IGNORE INTO pinglunxinxi(nicheng,pinglun,chanpingxinxi) VALUES (%s, %s, %s)"
|
||||||
|
cursor.execute(sql, (row[0], row[1], row[2])) #设csv与数据库对应
|
||||||
|
try:
|
||||||
|
cnx.commit()
|
||||||
|
print("数据导入成功!")
|
||||||
|
except mysql.connector.Error as err:
|
||||||
|
print(f"数据导入失败: {err}")
|
||||||
|
finally:
|
||||||
|
cursor.close()
|
||||||
|
cnx.close()
|
@ -0,0 +1,30 @@
|
|||||||
|
from typing import List
|
||||||
|
|
||||||
|
import mysql
|
||||||
|
import mysql.connector
|
||||||
|
import csv
|
||||||
|
def hello():
|
||||||
|
db_config = {
|
||||||
|
'host': 'localhost',
|
||||||
|
'user': 'root',
|
||||||
|
'password': '12345678M',
|
||||||
|
'database': 'pinglun',
|
||||||
|
}
|
||||||
|
cnx = mysql.connector.connect(**db_config)
|
||||||
|
cursor = cnx.cursor()
|
||||||
|
# 读取CSV
|
||||||
|
with open('抖音评论.csv', mode='r', encoding='utf-8') as file:
|
||||||
|
reader = csv.reader(file)
|
||||||
|
headers = next(reader, None)
|
||||||
|
if headers is not None: # 过表头
|
||||||
|
for row in reader:
|
||||||
|
sql = "INSERT IGNORE INTO douyinpinglunxinxi(nicheng,zhanghao) VALUES (%s, %s)"
|
||||||
|
cursor.execute(sql, (row[0], row[1])) #设csv与数据库对应
|
||||||
|
try:
|
||||||
|
cnx.commit()
|
||||||
|
print("数据导入成功!")
|
||||||
|
except mysql.connector.Error as err:
|
||||||
|
print(f"数据导入失败: {err}")
|
||||||
|
finally:
|
||||||
|
cursor.close()
|
||||||
|
cnx.close()
|
@ -0,0 +1,20 @@
|
|||||||
|
from selenium import webdriver
|
||||||
|
from selenium.webdriver.common.by import By
|
||||||
|
|
||||||
|
from selenium.webdriver.common.keys import Keys
|
||||||
|
from time import sleep
|
||||||
|
|
||||||
|
# 实例化两个浏览器
|
||||||
|
|
||||||
|
driver_edge = webdriver.Edge()
|
||||||
|
|
||||||
|
my_url = "https://www.douyin.com/"
|
||||||
|
|
||||||
|
driver_edge.get(my_url)
|
||||||
|
sleep(5)
|
||||||
|
x=driver_edge.find_element(By.XPATH,'//*[@id="login-pannel"]/div[2]')
|
||||||
|
x.click()
|
||||||
|
sleep(10)
|
||||||
|
|
||||||
|
|
||||||
|
search_box = driver_edge.find_element(By.XPATH,'//*[@id="douyin-header"]/div[1]/header/div/div/div[1]/div/div[2]/div/div/input').send_keys('50360824538',Keys.ENTER)
|
@ -0,0 +1,18 @@
|
|||||||
|
import requests
|
||||||
|
import re
|
||||||
|
from tqdm import tqdm,trange
|
||||||
|
url="https://0e1e652b3fded2c214e3e0157920582f9bea23f486354785.v.smtcdns.com/moviets.tc.qq.com/AYypFrqQ7L550DLKzwRzMWfkE9nzzWcbCmw2gAsdJjto/B_JxNyiJmktHRgresXhfyMeidH8TgfldSux1TdZJZ-VV2nT5dnS4eZBXZ9iizdepRG/svp_50112/xy4-f29jFn3e3vqA1mSyBEs-A0DLDwcvGCl1dCWFOblum3Ay_C9gfYwBNdA2P2_lv9rMCuGv2h9SC_c0BEi2racgVxMXZ2PgXd40jFTvhVvPPgAN3QZjDStQvS17FRTBSbCHCFjj1dW7V0NMVGUK1GM06Gj_fRC9MKiqsDyjtBzWvzFxDD0QABkvyVPUouKC3Bf-mtx6xjfOBuOojGDtI-UB0ufJf7ZwSB--OVj1IGwsfSap87fWTg/gzc_1000102_0b533iaagaaa2yagw2sfvbtmbwwdaovaab2a.f321002.ts.m3u8?ver=4"
|
||||||
|
|
||||||
|
response= requests.get(url)
|
||||||
|
|
||||||
|
|
||||||
|
m3u8_text= response.text
|
||||||
|
|
||||||
|
m3u8_text=re.sub('#.*','',m3u8_text)
|
||||||
|
|
||||||
|
ts_list = m3u8_text.split()
|
||||||
|
for ts in tqdm(ts_list):
|
||||||
|
ts_url='https://0e1e652b3fded2c214e3e0157920582f9bea23f486354785.v.smtcdns.com/moviets.tc.qq.com/AYypFrqQ7L550DLKzwRzMWfkE9nzzWcbCmw2gAsdJjto/B_JxNyiJmktHRgresXhfyMeidH8TgfldSux1TdZJZ-VV2nT5dnS4eZBXZ9iizdepRG/svp_50112/xy4-f29jFn3e3vqA1mSyBEs-A0DLDwcvGCl1dCWFOblum3Ay_C9gfYwBNdA2P2_lv9rMCuGv2h9SC_c0BEi2racgVxMXZ2PgXd40jFTvhVvPPgAN3QZjDStQvS17FRTBSbCHCFjj1dW7V0NMVGUK1GM06Gj_fRC9MKiqsDyjtBzWvzFxDD0QABkvyVPUouKC3Bf-mtx6xjfOBuOojGDtI-UB0ufJf7ZwSB--OVj1IGwsfSap87fWTg/'+ts
|
||||||
|
#保存数据
|
||||||
|
video=requests.get(ts_url).content
|
||||||
|
open("庆余年3.mp4",mode='ab').write(video)
|
Binary file not shown.
|
|
Loading…
Reference in new issue