diff --git a/GetUid.py b/GetUid.py index da9bd91..076d03c 100644 --- a/GetUid.py +++ b/GetUid.py @@ -9,19 +9,15 @@ # 定义搜索关键词列表 keywords = [ - 'ACT游戏', - '总站', + 'ACT安卓直装', '弹力摇', - 'AKT 合集 同人', - '双端黄油', - '里番', - '合集 黄油 同人', - '原神 同人', - 'SLG游戏', - '自取 动态 评论', - 'GAL游戏', - 'RPG 游戏 黄油', + '原神崩铁同人AKT', + '安卓直装', + 'SLG黄油安卓直装', + 'RPG安卓直装', + '红绿灯倒计时盯榨', '月入 代价', + '免费白嫖百度网盘会员svip365天体验劵' @@ -50,9 +46,7 @@ def search_and_extract_uid(keyword): } search_url = base_url + urlencode(search_params) - - - + print( search_url) try: # 添加头部信息 headers = { @@ -60,7 +54,7 @@ def search_and_extract_uid(keyword): } # 发起HTTP GET请求获取搜索结果页面内容 - response = requests.get(search_url, headers=headers, ) + response = requests.get(search_url, headers=headers) response.raise_for_status() # 检查请求是否成功 # 使用BeautifulSoup加载HTML内容 @@ -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) diff --git a/Report.py b/Report.py index d210165..af52358 100644 --- a/Report.py +++ b/Report.py @@ -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): @@ -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 @@ -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: @@ -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) @@ -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 # 成功验证后跳出循环 @@ -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 diff --git a/blacklist.txt b/blacklist.txt index 555f102..6dfad5d 100644 --- a/blacklist.txt +++ b/blacklist.txt @@ -1,463 +1,5 @@ -481292176 +41427397 -284221 -342004884 -257750083 -3493095136037291 -1165716285 -508597254 -3546603744922237 -3493129585953386 -3546610155916169 -381539 -2125468328 -3546578526669024 - -437309 -619343 -415407476 -23091718 -3546603744922237 -3493129585953386 -3546610155916169 -1507430209 -3493083809319461 -3493137393649995 -3546645098662692 -3546653334178122 -20060942 -3546658656749804 -696197091 -3546656865782759 -1784631 -2472704 -4055456 -4765827 -1433598692 -4877053 -354661015591 -4921875 -6403762 -6966899 -7624753 -8028343 -8303737 -8785358 -8844929 -9991441 -11134116 -11819125 -13294925 -13728886 -13974392 -16953492 -19073031 -19651321 -20751595 -25754025 -26231446 -26964994 -27708486 -29027483 -31114836 -32716327 -34567400 -34666780 -34713349 -36139485 -36951442 -39035912 -39276127 -39868638 -46466230 -52828319 -52861175 -55272237 -59982805 -66612385 -66681935 -66773440 -80218264 -81055168 -86137764 -87338605 -89143883 -91282907 -106808187 -107537165 -111338819 -113661668 -142848396 -150362595 -157428942 -170004007 -178247730 -186689218 -190201204 -199975501 -204840002 -223226228 -227979462 -240814697 -240835198 -249132912 -256451885 -258881705 -260940868 -262471130 -284784795 -286777192 -287479544 -294751134 -294808711 -295406344 -297993336 -299714631 -301890653 -313602591 -319311136 -320494275 -322588421 -325544442 -329566366 -334449128 -343561659 -345923501 -345953874 -346353622 -347014434 -349552221 -351664793 -352616521 -352859345 -353996292 -354395690 -357773680 -360996120 -362064353 -367482896 -372253592 -375033549 -378583222 -381649234 -381703448 -386260668 -388204416 -397581215 -399887388 -400024073 -400432063 -402344021 -402882206 -403474841 -406557531 -407520803 -415360841 -419113651 -419745601 -421152335 -424254969 -432572586 -433981586 -435031720 -435990302 -437837362 -437916889 -438685913 -439977633 -440101144 -441383357 -451138864 -452078996 -452320248 -454175185 -454201763 -454931471 -457761591 -474936406 -475502452 - -487242274 -487867143 -487975441 -489790304 -493895564 -496091344 -496310176 -496860200 -497753667 -498172631 -498785459 -501723044 -504579825 -506265215 -509107841 -510252078 -510619465 -511231487 -512119475 -514139807 -514369067 -520313840 -520687653 -522759624 -526582847 -535852297 -543102119 -551639731 -558021443 -576414434 -592348096 -597756691 -601656388 -602889822 -620338171 -621747036 - -640989150 -644871469 -646585782 -650299468 -650614912 -651688394 -675229757 -677522165 -688499435 -690041059 -691186833 -693493677 -694082221 -698441561 -1005171281 -1019793697 -1034005732 -1034044237 -1087142647 -1094983296 -1110497719 -1146788043 -1162181897 -1164793185 -1172076197 -1187168936 -1209345649 -1260625422 -1262240481 -1265590334 -1280948674 -1303897693 -1311015865 -1339843858 -1356026519 -1366656492 -1393504860 -1414900691 -1433598692 -1442051169 -1459554942 -1462454515 -1480985324 -1496220236 -1522197595 -1568441028 -1580600801 -1605326639 -1616787963 -1634197046 -1679240976 -1686545541 -1697714160 -1709039444 -1715110943 -1716505190 -1720922040 -1731245340 -1737433303 -1750791000 - -1784653925 -1799363131 -1823842054 -1846050066 -1848514728 -1851827534 -1858492851 -1860513723 -1878448190 -1940702417 -1968202131 -1972177333 -1975422206 -2003843586 -2033132317 -2060105193 -2072709250 -2116984070 -2131444745 -354670731067 -3461565638511011 -3461567500781810 -3461572678650770 -3461572728981518 -3461575872613023 -3461579209181942 -3461580310186825 -3461582541556617 -3493076456704284 -3493078765668740 -3493079621307009 -3493082557319753 -3493110155840101 -3493110285863721 -3493123560835285 -3493126029183272 -3493127058885311 3493137005677523 -3493137745971857 -3493137989241055 -3493139367070149 -3493139711003547 -3493143401990495 -3493257216526485 -3493258573383741 -3493258810362494 -3493258944579627 -3493263478622256 -3493269673609911 -3493275954579809 -3493278328555677 -3493290234087796 -3493290376694066 -3493294245939212 -3494352760342804 -3494357080476333 -3494358638659826 -3494358712060306 -3494361524341138 -3494364095449105 -3494369401243812 -3494371544533586 -3494373436164119 -3537116866808147 -3537118162847744 -3537119534386001 -3537119586814809 -3537121828669841 -3546373158865080 -3546376981973701 -3546385997629579 -3546386259773926 -3546387121703031 -3546555827095866 -3546558289152058 -3546560837191996 -3546561957071769 -3546563800468133 -3546564266035719 -3546565763402122 -3546566514182902 -3546568445659478 -3546569024473612 -3546569034959775 -3546570079341399 -3546573246040884 -3546579587828092 -3546585055103918 -3546585420008220 -3546588622358671 -3546592112019480 -3546594498578700 -3546595293399207 -3546596186786652 -3546600924252686 -3546603671522168 -3546604162255251 -3546604468439053 -3546605401672668 -3546606880164503 -3546608811641160 -3546611948980569 -3546614446689222 -3546615723853977 -3546615759505693 -3546615929375397 -3546616103438516 -3546619605683173 -3546620933179410 -3546623447665369 -3546623651088881 -3546624871631163 -3546626989754379 -3546637418891414 -3546639469906805 -3546639893531230 -3546641158113870 -3546641294429109 -3546644215761491 -3546645941717795 -3546646176598282 -3546647468443664 -3546647657188325 -3546648328276217 -3546650024872068 -3546650903579267 -3546652579203655 -3546652726004645 -3546654349199823 -3546657765459990 -3546657981466818 -3546658650458684 -3546659048917580 -3546661733271763 -3546661869586843 -3546668368661377 -3546671025752878 -3546671086569823 -3546671097055739 -3546671099152610 -3546672149826092 -3546674028874627 -3546674955815131 -3546675100519067 -3546676373489704 -3546676428016272 -3546676608371293 -3546676614662629 -3546676958595082 -3546677038287224 -3546677224934120 -3546678558722882 -3546679236102156 -3546679739419282 -3546680196597866 -3546680408410729 -3546680926406957 -3546681853348151 -3546683744979602 -3546684325890691 -3546686815210121 -3546687041701996 -3546690879490436 -3546691319892442 -3546692601251931 -3546693760977023 -3546694117493238 -3546695331743802 -3546696011221680 -3546696109787515 -3546696602618482 -3546697940601210 -3546699496687754 -3546705641343760 -3546706998200865 -3546708522830485 -3546708627688320 -3546709357496373 -3546710693382230 -3546710756297171 -3546712316578253 -3546712647928501 -3546714621348603 -3546715659438573 -2125468328 -3546578526669024 + +431073645 diff --git a/build/GetUid/base_library.zip b/build/GetUid/base_library.zip new file mode 100644 index 0000000..14311fe Binary files /dev/null and b/build/GetUid/base_library.zip differ diff --git a/src/__pycache__/__init__.cpython-312.pyc b/src/__pycache__/__init__.cpython-312.pyc new file mode 100644 index 0000000..86c5d73 Binary files /dev/null and b/src/__pycache__/__init__.cpython-312.pyc differ diff --git a/uid.txt b/uid.txt new file mode 100644 index 0000000..e69de29 diff --git a/uid_backup.txt b/uid_backup.txt new file mode 100644 index 0000000..0fa68ee --- /dev/null +++ b/uid_backup.txt @@ -0,0 +1,3 @@ +关键词 "免费白嫖百度网盘会员svip365天体验劵" 的UID列表: +3546571532667740 + diff --git a/whitelist.txt b/whitelist.txt index fd33c99..cb017c3 100644 --- a/whitelist.txt +++ b/whitelist.txt @@ -1,463 +1,2 @@ 2125468328 3546578526669024 -481292176 - -284221 -342004884 -257750083 -3493095136037291 -1165716285 -508597254 -3546603744922237 -3493129585953386 -3546610155916169 -381539 -2125468328 -3546578526669024 - -437309 -619343 -415407476 -23091718 -3546603744922237 -3493129585953386 -3546610155916169 -1507430209 -3493083809319461 -3493137393649995 -3546645098662692 -3546653334178122 -20060942 -3546658656749804 -696197091 -3546656865782759 -1784631 -2472704 -4055456 -4765827 -1433598692 -4877053 -354661015591 -4921875 -6403762 -6966899 -7624753 -8028343 -8303737 -8785358 -8844929 -9991441 -11134116 -11819125 -13294925 -13728886 -13974392 -16953492 -19073031 -19651321 -20751595 -25754025 -26231446 -26964994 -27708486 -29027483 -31114836 -32716327 -34567400 -34666780 -34713349 -36139485 -36951442 -39035912 -39276127 -39868638 -46466230 -52828319 -52861175 -55272237 -59982805 -66612385 -66681935 -66773440 -80218264 -81055168 -86137764 -87338605 -89143883 -91282907 -106808187 -107537165 -111338819 -113661668 -142848396 -150362595 -157428942 -170004007 -178247730 -186689218 -190201204 -199975501 -204840002 -223226228 -227979462 -240814697 -240835198 -249132912 -256451885 -258881705 -260940868 -262471130 -284784795 -286777192 -287479544 -294751134 -294808711 -295406344 -297993336 -299714631 -301890653 -313602591 -319311136 -320494275 -322588421 -325544442 -329566366 -334449128 -343561659 -345923501 -345953874 -346353622 -347014434 -349552221 -351664793 -352616521 -352859345 -353996292 -354395690 -357773680 -360996120 -362064353 -367482896 -372253592 -375033549 -378583222 -381649234 -381703448 -386260668 -388204416 -397581215 -399887388 -400024073 -400432063 -402344021 -402882206 -403474841 -406557531 -407520803 -415360841 -419113651 -419745601 -421152335 -424254969 -432572586 -433981586 -435031720 -435990302 -437837362 -437916889 -438685913 -439977633 -440101144 -441383357 -451138864 -452078996 -452320248 -454175185 -454201763 -454931471 -457761591 -474936406 -475502452 - -487242274 -487867143 -487975441 -489790304 -493895564 -496091344 -496310176 -496860200 -497753667 -498172631 -498785459 -501723044 -504579825 -506265215 -509107841 -510252078 -510619465 -511231487 -512119475 -514139807 -514369067 -520313840 -520687653 -522759624 -526582847 -535852297 -543102119 -551639731 -558021443 -576414434 -592348096 -597756691 -601656388 -602889822 -620338171 -621747036 - -640989150 -644871469 -646585782 -650299468 -650614912 -651688394 -675229757 -677522165 -688499435 -690041059 -691186833 -693493677 -694082221 -698441561 -1005171281 -1019793697 -1034005732 -1034044237 -1087142647 -1094983296 -1110497719 -1146788043 -1162181897 -1164793185 -1172076197 -1187168936 -1209345649 -1260625422 -1262240481 -1265590334 -1280948674 -1303897693 -1311015865 -1339843858 -1356026519 -1366656492 -1393504860 -1414900691 -1433598692 -1442051169 -1459554942 -1462454515 -1480985324 -1496220236 -1522197595 -1568441028 -1580600801 -1605326639 -1616787963 -1634197046 -1679240976 -1686545541 -1697714160 -1709039444 -1715110943 -1716505190 -1720922040 -1731245340 -1737433303 -1750791000 - -1784653925 -1799363131 -1823842054 -1846050066 -1848514728 -1851827534 -1858492851 -1860513723 -1878448190 -1940702417 -1968202131 -1972177333 -1975422206 -2003843586 -2033132317 -2060105193 -2072709250 -2116984070 -2131444745 -354670731067 -3461565638511011 -3461567500781810 -3461572678650770 -3461572728981518 -3461575872613023 -3461579209181942 -3461580310186825 -3461582541556617 -3493076456704284 -3493078765668740 -3493079621307009 -3493082557319753 -3493110155840101 -3493110285863721 -3493123560835285 -3493126029183272 -3493127058885311 -3493137005677523 -3493137745971857 -3493137989241055 -3493139367070149 -3493139711003547 -3493143401990495 -3493257216526485 -3493258573383741 -3493258810362494 -3493258944579627 -3493263478622256 -3493269673609911 -3493275954579809 -3493278328555677 -3493290234087796 -3493290376694066 -3493294245939212 -3494352760342804 -3494357080476333 -3494358638659826 -3494358712060306 -3494361524341138 -3494364095449105 -3494369401243812 -3494371544533586 -3494373436164119 -3537116866808147 -3537118162847744 -3537119534386001 -3537119586814809 -3537121828669841 -3546373158865080 -3546376981973701 -3546385997629579 -3546386259773926 -3546387121703031 -3546555827095866 -3546558289152058 -3546560837191996 -3546561957071769 -3546563800468133 -3546564266035719 -3546565763402122 -3546566514182902 -3546568445659478 -3546569024473612 -3546569034959775 -3546570079341399 -3546573246040884 -3546579587828092 -3546585055103918 -3546585420008220 -3546588622358671 -3546592112019480 -3546594498578700 -3546595293399207 -3546596186786652 -3546600924252686 -3546603671522168 -3546604162255251 -3546604468439053 -3546605401672668 -3546606880164503 -3546608811641160 -3546611948980569 -3546614446689222 -3546615723853977 -3546615759505693 -3546615929375397 -3546616103438516 -3546619605683173 -3546620933179410 -3546623447665369 -3546623651088881 -3546624871631163 -3546626989754379 -3546637418891414 -3546639469906805 -3546639893531230 -3546641158113870 -3546641294429109 -3546644215761491 -3546645941717795 -3546646176598282 -3546647468443664 -3546647657188325 -3546648328276217 -3546650024872068 -3546650903579267 -3546652579203655 -3546652726004645 -3546654349199823 -3546657765459990 -3546657981466818 -3546658650458684 -3546659048917580 -3546661733271763 -3546661869586843 -3546668368661377 -3546671025752878 -3546671086569823 -3546671097055739 -3546671099152610 -3546672149826092 -3546674028874627 -3546674955815131 -3546675100519067 -3546676373489704 -3546676428016272 -3546676608371293 -3546676614662629 -3546676958595082 -3546677038287224 -3546677224934120 -3546678558722882 -3546679236102156 -3546679739419282 -3546680196597866 -3546680408410729 -3546680926406957 -3546681853348151 -3546683744979602 -3546684325890691 -3546686815210121 -3546687041701996 -3546690879490436 -3546691319892442 -3546692601251931 -3546693760977023 -3546694117493238 -3546695331743802 -3546696011221680 -3546696109787515 -3546696602618482 -3546697940601210 -3546699496687754 -3546705641343760 -3546706998200865 -3546708522830485 -3546708627688320 -3546709357496373 -3546710693382230 -3546710756297171 -3546712316578253 -3546712647928501 -3546714621348603 -3546715659438573 diff --git "a/\350\207\252\345\212\250\344\270\276\346\212\245.js" "b/\350\207\252\345\212\250\344\270\276\346\212\245.js" new file mode 100644 index 0000000..7065c1f --- /dev/null +++ "b/\350\207\252\345\212\250\344\270\276\346\212\245.js" @@ -0,0 +1,346 @@ +// ==UserScript== +// @name BiliBili稿件批量举报(全自动) +// @namespace https://t.me/bilibilibatchreport +// @version 0.0.1 +// @description BiliBili屎太多,黑名单不够用了,我很痛苦,于是写了这个脚本尝试将痛苦转移到发布视频的人身上,我准备了三个举报理由,点击按钮即可切换 +// @author You +// @match *://*/* +// @grant GM_setValue +// @grant GM_getValue +// @grant GM_xmlhttpRequest +// @grant GM_registerMenuCommand +// @grant GM_unregisterMenuCommand +// @connect api.bilibili.com +// @connect www.bilibili.com +// @run-at document-end + +// ==/UserScript== + +// 存储三个profile的举报理由和tid + +const profiles = [ + { + tid: 10014, + reason: '色情视频,色情游戏,视频侮辱国家领导人习近平,宣扬“台独”,有政治隐喻' + }, + { + tid: 10018, + reason: '傻逼审核,粉丝多发黄游就不管是吧,我操死你们的妈,一帮傻逼玩意,愿你们马上猝死' + }, + { + tid: 10014, // 占位备用 + reason: '发布低俗图文及视频信息,或诱导他人私聊并推介线下色情服务;在账号资料、评论等环节,发布性暗示信息。利用黑话暗语、谐音词发布色情低俗动漫、视频、小说、游戏以及其他违法违规信息' + } +]; + +let currentProfileIndex = 0; // 初始化当前使用的profile索引 + +function switchProfile() { + currentProfileIndex = (currentProfileIndex + 1) % profiles.length; + updateDiagnosticInfo(`已切换至理由 ${currentProfileIndex + 1}
`); +} + +// 在页面上创建切换profile的按钮 +function addProfileSwitchButton() { + const switchButton = document.createElement('button'); + switchButton.textContent = '切换理由'; + switchButton.style.position = 'fixed'; + switchButton.style.top = '60px'; + switchButton.style.right = '150px'; + switchButton.style.zIndex = '9999'; + switchButton.onclick = function() { + switchProfile(); + }; + document.body.appendChild(switchButton); +} + +// Create floating window with scrollable content +const floatingWindow = document.createElement('div'); +floatingWindow.style.position = 'fixed'; +floatingWindow.style.top = '90px'; +floatingWindow.style.right = '20px'; +floatingWindow.style.zIndex = '9999'; +floatingWindow.style.background = 'white'; +floatingWindow.style.border = '1px solid #ccc'; +floatingWindow.style.padding = '10px'; +floatingWindow.style.maxWidth = '340px'; +floatingWindow.style.overflow = 'auto'; // Add overflow property for scrolling +floatingWindow.style.height = '200px'; // Set a height for the window +floatingWindow.style.scrollBehavior = 'smooth'; // Enable smooth scrolling +document.body.appendChild(floatingWindow); + +// Create diagnostic info container +const diagnosticInfo = document.createElement('div'); +floatingWindow.appendChild(diagnosticInfo); + +// Function to scroll to the bottom of the floating window +function scrollToBottom() { + floatingWindow.scrollTop = floatingWindow.scrollHeight; + // Scroll the last element into view + const lastElement = floatingWindow.lastElementChild; + if (lastElement) { + lastElement.scrollIntoView({ behavior: 'smooth', block: 'end' }); + } +} + +// Updating the diagnosticInfo.innerHTML with the scroll to bottom +function updateDiagnosticInfo(content) { + diagnosticInfo.innerHTML += content; + scrollToBottom(); +} + +let delayInMilliseconds = 2400; // 设置延迟时间 + +// 更新 sendReportRequest 函数,在显示完最后一次举报返回值后显示“本页全部举报完成”,然后调用 clickPreviousPageButton 函数 +function sendReportRequest() { + const mid = window.location.href.match(/bilibili.com\/(\d+)\/video/)[1]; + const csrf = getCsrf(); + const xhr = new XMLHttpRequest(); + xhr.open("POST", 'https://space.bilibili.com/ajax/report/add', true); + xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); + xhr.onload = function () { + const decodedResponse = JSON.parse(decodeURIComponent(this.response)); + updateDiagnosticInfo(`举报请求返回值:${Object.keys(decodedResponse).map(key => `${key}: ${decodedResponse[key]}`).join(', ')}
`); + // Call the existing functionality after the report request with a delay + setTimeout(() => { + getPageAllVideoAid(); + }, delayInMilliseconds); + }; + xhr.send(`mid=${mid}&reason=1%2C3%2C2&reason_v2=3&csrf=${csrf}`); +} + + + + +function addButton() { + // Existing button creation code remains unchanged + // Add a call to sendReportRequest before calling the existing functionality + const button = document.createElement('button'); + button.textContent = '自动举报所有稿件'; + button.style.position = 'fixed'; + button.style.top = '60px'; + button.style.right = '20px';// 更新 sendReportRequest 函数,在显示完最后一次举报返回值后显示“本页全部举报完成”,然后调用 clickPreviousPageButton 函数 +function sendReportRequest() { + const mid = window.location.href.match(/bilibili.com\/(\d+)\/video/)[1]; + const csrf = getCsrf(); + const xhr = new XMLHttpRequest(); + xhr.open("POST", 'https://space.bilibili.com/ajax/report/add', true); + xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); + xhr.onload = function () { + const decodedResponse = JSON.parse(decodeURIComponent(this.response)); + updateDiagnosticInfo(`举报请求返回值:${Object.keys(decodedResponse).map(key => `${key}: ${decodedResponse[key]}`).join(', ')}
`); + // Call the existing functionality after the report request with a delay + setTimeout(() => { + getPageAllVideoAid(); + }, delayInMilliseconds); + }; + xhr.send(`mid=${mid}&reason=1%2C3%2C2&reason_v2=3&csrf=${csrf}`); + +} + + button.style.zIndex = '9999'; + button.onclick = function() { + sendReportRequest(); + }; + document.body.appendChild(button); +} + +GM_registerMenuCommand("自动举报所有稿件", fuckBilibiliShitVideo); + +let csrfText = ''; + +function getCsrf() { + if (csrfText === '') { + const cook = document.cookie.match(/bili_jct=(.*?);/) ?? []; + if (cook.length === 2) { + csrfText = cook[1]; + } + } + return csrfText; +} + + + +function clickPreviousPageButton() { + setTimeout(() => { + updateDiagnosticInfo('本页全部举报成功
'); + const previousPageButton = document.querySelector('.be-pager-prev'); + + if (!previousPageButton) { + const errorMessage = document.createElement('div'); + updateDiagnosticInfo('未找到上一页按钮
'); + errorMessage.textContent = '未找到上一页按钮'; + errorMessage.style.color = 'red'; + document.body.appendChild(errorMessage); + return; // 提前结束函数执行 + } else if (previousPageButton.classList.contains('be-pager-disabled')) { + const errorMessage = document.createElement('div'); + errorMessage.textContent = '上一页按钮已被禁用'; + updateDiagnosticInfo('上一页按钮已被禁用
'); + errorMessage.style.color = 'red'; + document.body.appendChild(errorMessage); + return; // 提前结束函数执行 + } else { + previousPageButton.querySelector('a').click(); + setTimeout(fuckBilibiliShitVideo, 2500); + } + }, 500); +} + + + + +let encounteredError352 = false; // 添加一个全局变量来跟踪是否遇到了错误 -352 + +let reportCount = 0; // 添加一个变量用于记录举报次数 + +function fuckVideo(aid) { + reportCount++; // 每次举报增加序号 + const profile = profiles[currentProfileIndex]; + updateDiagnosticInfo(`开始举报稿件 ${reportCount},aid: ${aid}
`); + const xhr = new XMLHttpRequest(); + xhr.open("POST", 'https://api.bilibili.com/x/web-interface/appeal/v2/submit', true); + xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); + xhr.withCredentials = true; + xhr.onload = function () { + const responseJson = JSON.parse(this.response); + if (responseJson.code === -352) { + updateDiagnosticInfo('遇到错误 -352,请完成人机验证
'); + encounteredError352 = false; + } else { + updateDiagnosticInfo(`举报结果:${this.response}
`); + } + }; + xhr.send(`aid=${aid}&attach=&block_author=false&csrf=${getCsrf()}&desc=${encodeURIComponent(profile.reason)}&tid=${profile.tid}`); +} + +async function getVideoAid(id) { + return new Promise((resolve, reject) => { // 添加promise + if (encounteredError352) { // 如果遇到错误 -352 + updateDiagnosticInfo('遇到错误 -352,请点击“继续”按钮以继续代码执行
'); + // 暂停执行,并等待点击“继续”按钮 + const continueButton = document.createElement('button'); + continueButton.textContent = '继续'; + continueButton.style.position = 'fixed'; + continueButton.style.top = '60px'; + continueButton.style.right = '235px'; + continueButton.style.zIndex = '9999'; + continueButton.onclick = function() { + encounteredError352 = false; // 点击“继续”按钮后,将变量值改为false + resolve(null); // 继续执行并返回null + continueButton.remove(); // 移除“继续”按钮 + }; + document.body.appendChild(continueButton); + } else { + GM_xmlhttpRequest({ + url: `https://www.bilibili.com/video/${id}/?spm_id_from=333.999.0.0`, + method: "GET", + headers: { + 'Cookie': document.cookie // Pass the cookies from the page to the request + }, + onload: function (response) { + const aid = response.responseText.match(/"aid":(\d+)/); + if (aid) { + updateDiagnosticInfo(`成功获取到稿件,aid: ${aid[1]}
`); + resolve(aid[1]); + } else { + updateDiagnosticInfo('无法获取稿件 aid
'); + resolve(null); + } + } + }); + } + }); +} +async function getPageAllVideoAid() { + const idList = [...document.querySelectorAll('.list-list .list-item')].map((dom) => dom.getAttribute('data-aid')); + updateDiagnosticInfo(`获取到 ${idList.length} 个稿件
`); + for (let index = 0; index < idList.length; index++) { + const aid = await getVideoAid(idList[index]); + if (aid) { + // Add a delay before calling fuckVideo + await new Promise(resolve => setTimeout(resolve, delayInMilliseconds)); + fuckVideo(aid); + } + } +clickPreviousPageButton(); // 在所有操作完成后调用点击上一页按钮的函数 +} + +async function fuckBilibiliShitVideo() { + reportCount = 0; // 每次重新运行函数时重置序号 + updateDiagnosticInfo('开始自动举报所有稿件
'); + await getPageAllVideoAid(); + // 执行其他操作... +} + +// 添加一个按钮,点击后将链接中的数字写入用户剪贴板 +function addCopyIdButton() { + const userId = window.location.href.match(/bilibili.com\/(\d+)\//)[1]; // 获取链接中的数字部分 + const copyButton = document.createElement('button'); + copyButton.textContent = '复制用户ID'; + copyButton.style.position = 'fixed'; + copyButton.style.top = '60px'; // 调整按钮位置 + copyButton.style.right = '300px'; + copyButton.style.zIndex = '9999'; + copyButton.onclick = function() { + navigator.clipboard.writeText(`${userId}\n`); // 将数字写入剪贴板并加上换行符 + updateDiagnosticInfo(`用户ID ${userId} 已复制到剪贴板`); + }; + document.body.appendChild(copyButton); +} +function checkPage() { + // Extract current page number from URL + const urlParams = new URLSearchParams(window.location.search); + const currentPage = parseInt(urlParams.get('pn')); + + // Get total number of pages from the page element + const totalPagesElement = document.querySelector('span.be-pager-total'); + if (totalPagesElement) { + const totalText = totalPagesElement.innerText; + const totalMatches = totalText.match(/共 (\d+) 页/); + if (totalMatches && totalMatches.length > 1) { + const totalPages = parseInt(totalMatches[1]); + + // Get space ID from the URL + const spaceIdMatches = window.location.href.match(/space.bilibili.com\/(\d+)\//); + if (spaceIdMatches && spaceIdMatches.length > 1) { + const spaceId = spaceIdMatches[1]; + + // Compare current page with total pages + if (currentPage < totalPages) { + // Navigate to the next page + const nextUrl = `https://space.bilibili.com/${spaceId}/video?tid=0&pn=${totalPages}&keyword=&order=pubdate`; + window.location.href = nextUrl; + } else { + // Continue with remaining code if currentPage equals totalPages + console.log('Current page is the last page. Continuing with the rest of the script.'); + } + } else { + console.error('Failed to extract space ID from the URL.'); + } + } else { + console.error('Failed to extract total pages from the page.'); + } + } else { + console.error('Total pages element not found.'); + } + } + + + +async function runAfterDelay() { + await new Promise(resolve => setTimeout(resolve, 2000)); // 等待5秒钟 + + if (window.location.hostname === "space.bilibili.com") { + checkPage(); + addButton(); // 添加举报按钮 + addProfileSwitchButton(); // 添加切换profile的按钮 + addCopyIdButton(); // 添加复制用户ID的按钮 + fuckBilibiliShitVideo(); + } +} + +window.addEventListener('load', () => { + runAfterDelay(); +}); + diff --git "a/\351\230\273\346\255\242\345\274\271\347\252\227.js" "b/\351\230\273\346\255\242\345\274\271\347\252\227.js" new file mode 100644 index 0000000..cd0ad17 --- /dev/null +++ "b/\351\230\273\346\255\242\345\274\271\347\252\227.js" @@ -0,0 +1,31 @@ +// ==UserScript== +// @name 阻止弹窗 +// @namespace http://tampermonkey.net/ +// @version 0.1 +// @description 用于阻止举报成功后的弹窗,使脚本正常运行 +// @author You +// @match *://*/* +// @grant none +// ==/UserScript== + +(function() { + 'use strict'; + + // Override window.alert to do nothing + window.alert = function(str) { + return; + }; + + // Override window.confirm to always return true + window.confirm = function(str) { + return true; + }; + + // Override window.prompt to always return null + window.prompt = function(str) { + return null; + }; + + // Add additional overrides as needed + +})();