在爬取国外杂志网站的时候,一些标题需要进行翻译。下载第三方库
pip install googletrans
from googletrans import Translator
def Tran(datas):
translato = Translator(service_urls=['translate.google.cn'])
return translator.translate(datas,dest='zh-CN').text
print(Tran('journal'))
//Chinese Simplified: zh-CN
//Chinese Traditional: zh-TW
//English: en
//German: de
//Japanese: ja
//Korean: ko
//French: fr