Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
ayyayyayy2002 committed Jul 12, 2024
1 parent 78c445d commit 5c0f935
Show file tree
Hide file tree
Showing 10 changed files with 415 additions and 950 deletions.
28 changes: 13 additions & 15 deletions GetUid.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,15 @@

# 定义搜索关键词列表
keywords = [
'ACT游戏',
'总站',
'ACT安卓直装',
'弹力摇',
'AKT 合集 同人',
'双端黄油',
'里番',
'合集 黄油 同人',
'原神 同人',
'SLG游戏',
'自取 动态 评论',
'GAL游戏',
'RPG 游戏 黄油',
'原神崩铁同人AKT',
'安卓直装',
'SLG黄油安卓直装',
'RPG安卓直装',
'红绿灯倒计时盯榨',
'月入 代价',
'免费白嫖百度网盘会员svip365天体验劵'



Expand Down Expand Up @@ -50,17 +46,15 @@ def search_and_extract_uid(keyword):

}
search_url = base_url + urlencode(search_params)



print( search_url)
try:
# 添加头部信息
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36',
}

# 发起HTTP GET请求获取搜索结果页面内容
response = requests.get(search_url, headers=headers, )
response = requests.get(search_url, headers=headers)
response.raise_for_status() # 检查请求是否成功

# 使用BeautifulSoup加载HTML内容
Expand All @@ -70,10 +64,14 @@ def search_and_extract_uid(keyword):
uid_list = []

# 使用CSS选择器定位搜索结果的链接,并提取UID
count = 0 # 计数器,用于限制获取的UID数量
for link in soup.select('.bili-video-card .bili-video-card__info--owner'):
if count >= 30:
break
href = link['href']
uid = href.split('/')[-1] # 获取链接中最后的数字部分作为UID
uid_list.append(uid)
count += 1

# 将UID列表传递给处理函数(这里假设是process_uid_list函数)
process_uid_list(keyword, uid_list)
Expand Down
32 changes: 19 additions & 13 deletions Report.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from selenium.webdriver.common.action_chains import ActionChains
import requests
from src import captcha
from urlextract import URLExtract



def remove_completed_uid(uid):
Expand Down Expand Up @@ -65,6 +65,8 @@ def main():
for uid in uids:
url = f"https://space.bilibili.com/{uid}/video?tid=0&pn=1&keyword=&order=pubdate"
driver.get(url)
# time.sleep(2)
# driver.refresh()
print(f"UID: {uid} 页面已打开")
current_window = driver.current_window_handle

Expand All @@ -76,25 +78,24 @@ def main():
driver.switch_to.new_window('tab')
driver.get("https://www.bilibili.com/appeal/?avid=14692212")

element = WebDriverWait(driver, 20, 0.5).until(
element = WebDriverWait(driver, 20, 1).until(
EC.presence_of_element_located((By.XPATH, '/html/body/div[1]/div/div[3]/div[2]/textarea'))
)
element.send_keys('Python')
print('已输入理由')

element = WebDriverWait(driver, 20, 0.5).until(
element = WebDriverWait(driver, 20, 1).until(
EC.presence_of_element_located(
(By.XPATH, '/html/body/div/div/div[2]/div[1]/div[2]/div[1]/div'))
)
element.click()
try:
alert = driver.switch_to.alert
alert.accept()
except:
pass
element = WebDriverWait(driver, 20, 0.5).until(
element.click() #选择分类
print('已选择分类')

element = WebDriverWait(driver, 20, 1).until(
EC.presence_of_element_located((By.XPATH, '/html/body/div/div/div[5]/div[2]'))
)
element.click()
element.click() #生成验证码
print('已点击确认')

time.sleep(4)
while True:
Expand All @@ -103,7 +104,8 @@ def main():
img = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.XPATH, '//*[@class="geetest_item_wrap"]')))
f = img.get_attribute('style')
extractor = URLExtract()
print('验证码已出现')

url = re.search(r'url\("([^"]+?)\?[^"]*"\);', f).group(1)

print(url)
Expand Down Expand Up @@ -142,19 +144,23 @@ def get_location(target):
-(b + y * lan_y)).perform() # 将鼠标位置恢复到移动前
time.sleep(0.5)


# 执行点击确认按钮的操作
try:
element = WebDriverWait(driver, 10).until(
EC.element_to_be_clickable((By.CLASS_NAME, 'geetest_commit_tip')))
element.click() # 点击确认按钮
print('已提交验证码')
except:
refresh_element = WebDriverWait(driver, 10).until(
EC.element_to_be_clickable((By.CLASS_NAME, 'geetest_refresh')))
refresh_element.click() # 点击刷新验证按钮
print('已点击刷新按钮')

# 等待 'geetest_item_wrap' 元素消失,表示验证码验证成功
WebDriverWait(driver, 3).until(
EC.invisibility_of_element_located((By.XPATH, '//*[@class="geetest_item_wrap"]')))
print('验证码已消失')

print("验证码验证成功!")
break # 成功验证后跳出循环
Expand All @@ -172,7 +178,7 @@ def get_location(target):

# 检查当前页面URL是否符合条件
current_url = driver.current_url
if "pn=1" in current_url:
if "pn=1&" in current_url:
print("地址栏中包含 'pn=1',等待下一个UID")
remove_completed_uid(uid) # 删除已完成的UID
break
Expand Down
Loading

0 comments on commit 5c0f935

Please sign in to comment.