selenium 不断切换代理 打淘宝小店流量
来源:互联网 发布:复杂网络 大数据 编辑:程序博客网 时间:2024/04/28 16:28
写个脚本,模拟浏览器搜索商品,并不断打流量。
在centos 6.2上测试通过。
#-*- coding:utf-8 –*-import seleniumfrom selenium import webdriverfrom selenium.common.exceptions import NoSuchElementExceptionfrom selenium.webdriver.common.keys import Keysfrom selenium.webdriver.common.by import Byimport timeimport datetimedef getSearchURL(): urlPrefix = ('http://s.taobao.com/search?q=%B5%C2%B9%FA%B0%AE%CB%FB%C3%C03%B6%CE&commend=all&search_type=item&sourceId=tb.index&spm=1.1000386.5803581.d4908513') urlPostfix_t = "&initiative_id=tbindexz_%s" today = datetime.date.today() datestr = today.strftime('%Y%m%d') urlPostfix = urlPostfix_t % datestr url = urlPrefix + urlPostfix return urlPROXY_HOST = "61.242.169.94"PROXY_PORT = 81 fp = webdriver.FirefoxProfile() # Direct = 0, Manual = 1, PAC = 2, AUTODETECT = 4, SYSTEM = 5fp.set_preference("network.proxy.type", 1) fp.set_preference("network.proxy.http", PROXY_HOST)fp.set_preference("network.proxy.http_port", PROXY_PORT)fp.set_preference("network.proxy.ftp", PROXY_HOST)fp.set_preference("network.proxy.ftp_port", PROXY_PORT)fp.set_preference("network.proxy.ssl", PROXY_HOST)fp.set_preference("network.proxy.ssl_port", PROXY_PORT) fp.set_preference("network.proxy.no_proxies_on", "") # set this value as desired driver = webdriver.Firefox()#driver = webdriver.Firefox(firefox_profile=fp)driver.implicitly_wait(10)#driver.get('http://www.ip138.com/')url = getSearchURL()driver.get(url)elem = Nonewhile 1: try: time.sleep(0.2) elem = driver.find_element_by_link_text("fanwb1985") except selenium.common.exceptions.NoSuchElementException : elem = driver.find_element_by_link_text("下一页") elem.click() continue if elem: elem.click() breakfindStr = '''t'''links = driver.find_elements_by_partial_link_text(findStr)linksH= []for link in links: #print link.get_attribute("href") linka= link.get_attribute("href") linksH.append(linka)print linksH'''foo = driver.find_element_by_tag_name("a")for element in foo: link = element.getAttribute("src") if str(link).find(findStr)!= -1: links.append(link)links = list(set(links))print links'''driver.close()
0 0
- selenium 不断切换代理 打淘宝小店流量
- 喜爱的淘宝店-不断添加更新
- 一个刷淘宝店铺流量的小外挂
- 【小白】selenium入门(一)学习笔记+登录淘宝
- 淘宝小店开张
- selenium 代理
- Python Selenium 常用方法总结(不断补充) 原Po---Op小剑
- 基于selenium登录淘宝
- 淘宝爬虫(Selenium)
- 开个淘宝小店
- 淘宝站内优化——网店流量大提速
- 淘宝打底裤排行榜
- 淘宝店、淘宝商城排名规则及流量提升培训教程
- 淘宝店铺 加流量统计
- 淘宝流量规则知多少?
- 淘宝新店没有流量怎么回事
- Selenium+PhantomJS爬取淘宝
- selenium、python模拟登陆淘宝
- 【BZOJ2555】SubString
- 数据结构之红黑树——BST的变种2
- Java中各种正则表达式验证[邮箱、密码前后空格、日期合法、IP]
- QObject是QT所有类的基类
- MyBatis学习 之 三、动态SQL语句
- selenium 不断切换代理 打淘宝小店流量
- web.xml 详细介绍
- linux内核配置入门
- PS更换证件照背景颜色
- 注解与反射
- 二级指针用法示例
- PHP的mysql密码修改
- 欧拉角与方向余弦矩阵之间的转换
- C#键盘鼠标钩子