Python crawler Learning--with Python combined with selenium to achieve tomorrow's sub-program broadcast live for their favorite players automatically like canvassing!!!

Source: Internet
Author: User
Tags xpath

Disclaimer: This script is purely entertainment, forbidden to use illegal auto-likes canvassing!!! Gossip:

Tomorrow's son the second season began a long time, the author has been chasing, especially like inside that cool little brother-Cai Zeming. The first two days of the election 9 big brand, to take the form of live, the player will be promoted purely by fans manual praise, and special pit point is points 1000 times to calculate a decibel, then the author would like to write a script automatically praise, of course, no program ape Crazy cross the mountain Ah!!!!

The following is the promotion of the Nine Factory card is live automatic point like code (note in the code comments):
From selenium import webdriverfrom selenium.webdriver.common.by import byfrom selenium.webdriver.support.ui Import Webdriverwaitfrom selenium.webdriver.support import expected_conditions as Ecimport timeclass Tv (object): "" "in Pyth  On3 Environment, please choose the appropriate Webdriver "" "Def __init__ (self) According to your computer's operating environment, browser version, etc.: # The URL of the program live may change, please pay attention to Self.url = "Http://v.qq.com/live/p/topic/55607/index.html#player" Self.driver = Webdriver. Chrome () def run (self): Self.driver.get (Self.url) "" "The place where Data-id is going to be changed to the ID of the player you like: Outside: 51673  736 1673736 Cai Weize: 51673681 1673681 tian Brigitte: 51673438 1673438 Zhang Yihao: 51571292 1571292 Chu Hongkai: 51673432 1673432 Huangxiang: 51673693 1673693 Wen Shaojie: 51673466 1673466 Sun Zheyuan: 51573987 1573987 Deng Deng: 51673370 167337 0 If your favorite players have to pull down the list to see his likes button will not be loaded, you need to change the code to wait for their favorite player's likes button loaded to automatically like "" "while TRUE:WEBD Riverwait (Self.driver, +). Until (Ec.presence_of_element_located ((By.xpath, "//span[@data-id= ' 51673681 ']//button[@data-id= ' 1673681 '])) BTN = Self.driver.find_element_by_xpath ("//span[@data-id= ' 51673681 ']//button[@data-id= ' 1673681 ']") # The first time auto-click will trigger                Login interface Btn.click () Try: # appear login interface, will wait for users to choose or QQ Scan code Landing, please manually select the landing platform, and manually scan the code login. If Ec.presence_of_element_located ((By.xpath, '//a[@class = "Btn_qq _login_type_item"]): Login_button =                    Self.driver.find_element_by_xpath ('//a[@class = "Btn_qq _login_type_item"] ') Login_button.click () # Login I set is 10 seconds must complete Time.sleep (TEN) Except:pass # every 0.1 seconds point Hit # Time.sleep (0.1) TV = TV () Tv.run ()
Nine factory card upgrade station when the live point likes plus a mobile phone SMS verification, verify that after the popup please self-verification, after the verification and re-open the program is good! Disclaimer: This script is purely entertainment, forbidden to use illegal auto-likes canvassing!!!

Author: Halooyan

Python crawler Learning--with Python combined with selenium to achieve tomorrow's sub-program broadcast live for their favorite players automatically like canvassing!!!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.