u2b 刷订阅脚本(转自广告中国)

admin   ·   发表于 2018-4-29   ·   资源分享(公开)


from selenium import webdriver
import time
import random
PROXY = "127.0.0.1:8080" //http代理 
chrome_options = webdriver.ChromeOptions()
#chrome_options.add_argument("--headless") //headless模式下 youtube无法登陆 
#
#
chrome_options.add_argument('--proxy-server=%s' % PROXY)
chrome_options.add_argument("--incognito")
driver = webdriver.Chrome('/home/txx/chromedriver/chromedriver',chrome_options=chrome_options) //chromedriver 绝对路径
driver.get("https://www.youtube.com/");
time.sleep(3);
driver.find_element_by_xpath("//a[@class='yt-simple-endpoint style-scope ytd-button-renderer']").click()
time.sleep(5);
driver.find_element_by_xpath("//input[@type='email']").send_keys('u2b用户名')
driver.find_element_by_id('identifierNext').click()
time.sleep(15);
driver.find_element_by_xpath("//input[@type='password']").send_keys('u2b密码')
driver.find_element_by_id('passwordNext').click()
time.sleep(5);
driver.get("https://youlikehits.com/");
time.sleep(5);
driver.find_element_by_id("username").send_keys('youlikehits用户名')
driver.find_element_by_id("password").send_keys('youlikehits密码')
driver.find_element_by_xpath("//input[@value='Login']")
driver.find_element_by_xpath("//input[@value='Login']").click()
driver.get('https://youlikehits.com/youtube2.php')
time.sleep(5);
driver.execute_script('return document.querySelector("a[class=followbutton]")').click()
#time.sleep(10);
#driver.execute_script('return document.querySelector("a[class=likebutton]")').click()
#time.sleep(5);
print "Starting click for subscribe...."
driver.switch_to_window(driver.window_handles[0])
for i in range(0,50):
        print str(i) + " for click!"
        r = random.randint(0,10)
        time.sleep(30)
        if r == 6:
                driver.find_element_by_xpath("//a[text()='Skip this Account']").click()
                time.sleep(3)
        #driver.execute_script('return document.querySelector("a[class=likebutton]")').click()
        driver.find_element_by_xpath("//a[@class='likebutton']").click()
        driver.switch_to_window(driver.window_handles[1])
        time.sleep(10)
        driver.find_element_by_id("subscribe-button").click()
        time.sleep(5)
        driver.close()
        driver.switch_to_window(driver.window_handles[0])
        time.sleep(3)
driver.find_element_by_xpath("//a[@title='Logout of YouLikeHits']").click()


2 Reply   |  Until 2018-5-17 | 1221 View

9452867044
发表于 2018-5-10

哥们时时干 java的  请问这个是python2.7吗

评论列表

  • 加载数据中...

编写评论内容

hunk
发表于 2018-5-17

已经失效。

14行的sapn找不到。

评论列表

  • 加载数据中...

编写评论内容
LoginCan Publish Content

HYBBS © 2016. All Rights Reserved. 老农民

Powered by HYBBS Version 2.3.2