Python爬虫视频教程零基础小白到scrapy爬虫高手-轻松入门

https://item.taobao.com/item.htm?spm=a1z38n.10677092.0.0.482434a6EmUbbW&id=564564604865

selenium翻译会打开多个浏览器,效率很低,适合模拟登陆,不适合批量翻译

翻译结果

import requests,bs4,selenium
from selenium import webdriver words_list=["python","job","hello world"]
translation_list=[]
#selenium抓取信息太慢,要打开浏览器
def Get_translation(word):
browser=webdriver.Firefox()
url="http://dict.youdao.com/w/%s/#keyfrom=dict.index"%(word)
browser.get(url)
elem=browser.find_elements_by_class_name("trans-container")
translation=elem[0].text
return translation def Get_all_translation(words_list):
for word in words_list:
try:
translation=Get_translation(word)
translation_list.append(translation)
except:
print("exception:",word)
continue

  

selenium批量翻译的更多相关文章

  1. 【UWP】【新坑】Excel批量翻译工具(1)

    嗯……具体思路是这样的.使用的时候,你导入一个excel,直观地选择某些区域,选择语言点击翻译,就可以对多个单元格进行批量翻译,并且支持多种不同的导出格式(excel副本.txt文件……) 1,多种翻 ...

  2. 纯 Python 实现的 Google 批量翻译

    测试通过时间:2019-8-20 参阅:C#实现谷歌翻译API.Python之Google翻译爬虫 首先声明,没有什么不良动机,因为经常会用 translate.google.cn,就想着用 Pyth ...

  3. Python 批量翻译 使用有道api;

    妹子是做翻译相关的,遇到个问题,要求得到句子中的所有单词的 音标; 有道翻译只能对单个单词翻译音标,不能对多个单词或者句子段落翻译音标; 手工一个一个翻的话那就要累死人了.....于是就让我写个翻译音 ...

  4. 2018-12-25 VS Code英汉词典v0.0.8: 批量翻译文件部分命名

    续前文: VS Code英汉词典进化效果演示: 翻译文件所有命名 vscode"英汉词典"插件地址: 官方链接 现在实现的效果比之前的演示差很多, 因为executeDocumen ...

  5. unittest,selenium——批量,多线程执行多文档用例

    之前做过批量执行多.py文件,为了省时也做过单py文件多线程,现在做多py文件用例多线程 # coding:utf-8import unittestimport osimport timeimport ...

  6. 如何用python批量翻译文本?

    首先,看一下百度翻译的官方api文档. http://api.fanyi.baidu.com/api/trans/product/apidoc # coding=utf-8 #authority:bi ...

  7. python+selenium 批量执行时出现随机报错问题【已解决】

    出现场景:用discover方法批量执行py文件,出现随机性的报错(有时a.py报错,有时b.py报错...),共同特点:均是打开新窗口后,切换最新窗口,但定位不到新窗口的元素,超时报错.由于个人项目 ...

  8. selenium批量执行脚本操作

    import unittest import os from HTMLTestRunner import HTMLTestRunner # 待执行用例的目录 def allcase(): #引入执行用 ...

  9. 利用百度翻译API批量翻译文本

    有时间再做总结! # coding=utf-8 #authority:bing #2017-7-18 import httplib import md5 import urllib import ur ...

随机推荐

  1. 《Linux内核设计与实现》读书笔记 4 进程调度

    第四章进程调度 进程调度程序可看做在可运行太进程之间分配有限的处理器时间资源的内核子系统.调度程序是多任务操作系统的基础.通过调度程序的合理调度,系统资源才能最大限度地发挥作用,多进程才会有并发执行的 ...

  2. I/O(输入/输出)

    1.创建引用ObjectInputStream ois =null; ObjectOutputStream oos = null; ByteArrayInputStream bais = null; ...

  3. Chrome查看HTTP

    查找cookie 补充: 接口调试使用postman挺不错的.以前每次都自己写一个ajax来进行接收调试. 如:用post发送json数据给接口,得到json数据. 工具有时候能让效率大大提升,要学会 ...

  4. Why yarn

    http://www.cnblogs.com/LeftNotEasy/archive/2012/02/18/why-yarn.html https://www.ibm.com/developerwor ...

  5. Redis应用一例(存证数量用计数器实现)

    public Long getCreationCounter() { String host =PropertyUtils.getPropertyValue("redis.server.ho ...

  6. Win2012r2 以及win2016 安装.NET3.5

    自从微软的内核 6.2以上的版本之后 win2012 win2016 已经自带了 .net4.0的版本 但是很多应用还需要.net 3.5的版本,虽然微软的安装盘里面有 .net 3.5的安装文件,但 ...

  7. PHP hexdec() 函数

    hexdec() 函数把十六进制转换为十进制. 语法 hexdec(hex_string) 参数 描述 hex_string 必需.规定要转换的十六进制数. 说明 返回与 hex_string 参数所 ...

  8. Java之"instanceof"和"isInstance"代码举例

    源码: /** * @Date:2018-04-20 * @Description:判断Instance * - instanceof方法返回一个boolean类型的值,意在告诉我们对象是不是某个特定 ...

  9. matplotlib之scatter绘制散点

    # 使用matplotlib.pyplot.scatter绘制散点 import matplotlib.pyplot as plt from pylab import mpl # 设置默认字体,解决中 ...

  10. StringBuilder String string.Concat 字符串拼接速度再议

    首先看测试代码: public class StringSpeedTest { "; public string StringAdd(int count) { string str = st ...