Update an example
This commit is contained in:
parent
13c63fcca8
commit
a2817abcd8
|
@ -8,28 +8,25 @@ with SB(uc=True, test=True, ad_block=True, pls="none") as sb:
|
||||||
sb.uc_gui_click_captcha()
|
sb.uc_gui_click_captcha()
|
||||||
sb.sleep(0.5)
|
sb.sleep(0.5)
|
||||||
channel_name = "michaelmintz"
|
channel_name = "michaelmintz"
|
||||||
sb.cdp.press_keys('input[name="query"]', channel_name)
|
channel_title = "Michael Mintz"
|
||||||
sb.cdp.click('form[action*="/search"] button')
|
sb.cdp.press_keys('input[placeholder*="Search"]', channel_name)
|
||||||
sb.sleep(2)
|
|
||||||
sb.cdp.click('a[title="%s"] h2' % channel_name)
|
|
||||||
sb.sleep(1.5)
|
sb.sleep(1.5)
|
||||||
|
sb.cdp.click('a:contains("%s")' % channel_title)
|
||||||
|
sb.sleep(2)
|
||||||
sb.cdp.remove_elements("#lngtd-top-sticky")
|
sb.cdp.remove_elements("#lngtd-top-sticky")
|
||||||
sb.sleep(1.5)
|
sb.sleep(1.5)
|
||||||
name = sb.cdp.get_text("h1")
|
name = sb.cdp.get_text("h1")
|
||||||
link = sb.cdp.get_attribute("#YouTubeUserTopInfoBlockTop h4 a", "href")
|
source = sb.get_page_source()
|
||||||
subscribers = sb.cdp.get_text("#youtube-stats-header-subs")
|
base = "https://www.youtube.com/c/"
|
||||||
video_views = sb.cdp.get_text("#youtube-stats-header-views")
|
base2 = 'href="/youtube/c/'
|
||||||
rankings = sb.cdp.get_text(
|
start = source.find(base2) + len(base2)
|
||||||
'#socialblade-user-content [style*="border-bottom"]'
|
end = source.find('"', start)
|
||||||
).replace("\xa0", "").replace(" ", " ").replace(" ", " ")
|
link = base + source[start:end]
|
||||||
print("********** SocialBlade Stats for %s: **********" % name)
|
print("********** SocialBlade Stats for %s: **********" % name)
|
||||||
print(">>> (Link: %s) <<<" % link)
|
print(">>> (Link: %s) <<<" % link)
|
||||||
print("* YouTube Subscribers: %s" % subscribers)
|
print(sb.get_text('[class*="grid lg:hidden"]'))
|
||||||
print("* YouTube Video Views: %s" % video_views)
|
|
||||||
print("********** SocialBlade Ranks: **********")
|
print("********** SocialBlade Ranks: **********")
|
||||||
for row in rankings.split("\n"):
|
print(sb.get_text('[class*="gap-3 flex-1"]'))
|
||||||
if len(row.strip()) > 8:
|
|
||||||
print("--> " + row.strip())
|
|
||||||
for i in range(17):
|
for i in range(17):
|
||||||
sb.cdp.scroll_down(6)
|
sb.cdp.scroll_down(6)
|
||||||
sb.sleep(0.1)
|
sb.sleep(0.1)
|
||||||
|
|
Loading…
Reference in New Issue