Micro-channel public number search

Usage: python jiaoben.py keywords 
Sogou micro-letter search
# - * - Coding: UTF-8 - * -
from the Selenium Import webdriver
from SLEEP Time Import
from selenium.webdriver.chrome.options Import Options
Import Time
Import Requests, Re, SYS
from Import By selenium.webdriver.common.by
Import the Math
# @ author: strong skinned
# create a drive
chrome_options = Options ()
chrome_options.add_argument ( "headless")
chrome_options.add_argument ( "- Start-Maximized")
driver = webdriver. the Chrome (Options = chrome_options)
# Sogou micro channel number search public
URL = 'https://weixin.sogou.com/'
driver.get (URL)
SLEEP (2)
key_worlds the sys.argv = [. 1]
driver.find_element_by_id ( 'Query'). send_keys (key_worlds)
driver.find_element_by_class_name ( 'swz2'). the Click ()
SLEEP (2)
str1 = driver.find_element_by_class_name ( 'Mun'). text
num_str the re.search = ( "about Found (.? *) Articles ", str1)
NUM = int (num_str.group (1))
# access to information
DEF getinfor ():
wxmc = driver.find_elements_by_class_name ( 'TIT')
for WXM in wxmc:
Print (wxm.text )
WXY = driver.find_elements (= By.TAG_NAME by, value = 'label')
for WXM in WXY:
Print ( "micro signal:" + wxm.text)
# 100 visitors can obtain information
if num <= 100:
NUM = Page / 10
Page = Math.ceil (page) # rounded up to give Page
getinfor ()
for in Page Range (2, Page +. 1):
driver.find_element_by_link_text (STR (Page)) the Click ().
getinfor ()
SLEEP (2)
IF NUM> 100:
Print ( 'phone using the two-dimensional code scanning')
SLEEP (10)
Page NUM = / 10
Page = Math. ceil (page) # rounded up to give Page
getinfor ()
for Page in Range (2, Page +. 1):
. driver.find_element_by_link_text (STR (Page)) the Click ()
getinfor ()
SLEEP (2)
micro-channel public number official website search (anti-climb severe)
micro-channel app get a list of existing app

Guess you like

Origin www.cnblogs.com/qzdlp/p/12168286.html