forked from mdmintz/undetected-testing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmy_socialblade.py
30 lines (29 loc) · 1.23 KB
/
my_socialblade.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
"""Bypass bot-detection to view SocialBlade ranks for YouTube"""
from seleniumbase import SB
with SB(uc=True, test=True, ad_block=True, pls="none") as sb:
url = "https://socialblade.com/youtube/channel/UCSQElO8vQmNPuTgdd83BHdw"
sb.activate_cdp_mode(url)
sb.sleep(2)
sb.uc_gui_click_captcha()
sb.sleep(1.5)
sb.cdp.remove_elements("#lngtd-top-sticky")
sb.sleep(1.5)
name = sb.cdp.get_text("h1")
link = sb.cdp.get_attribute("#YouTubeUserTopInfoBlockTop h4 a", "href")
subscribers = sb.cdp.get_text("#youtube-stats-header-subs")
video_views = sb.cdp.get_text("#youtube-stats-header-views")
rankings = sb.cdp.get_text(
'#socialblade-user-content [style*="border-bottom"]'
).replace("\xa0", "").replace(" ", " ").replace(" ", " ")
print("********** SocialBlade Stats for %s: **********" % name)
print(">>> (Link: %s) <<<" % link)
print("* YouTube Subscribers: %s" % subscribers)
print("* YouTube Video Views: %s" % video_views)
print("********** SocialBlade Ranks: **********")
for row in rankings.split("\n"):
if len(row.strip()) > 8:
print("--> " + row.strip())
for i in range(17):
sb.cdp.scroll_down(6)
sb.sleep(0.1)
sb.sleep(2)