[英]Python - Scraping web data - using Ecommercetools module
I'm new to python, I'm still familiar with Scraping web data function. Here's my code我是 python 的新手,我仍然熟悉抓取 web 数据 function。这是我的代码
from ecommercetools import seo
mysearch=input('What do you need to search?')
results = seo.get_serps(mysearch,pages=2,domain=google.com)
My question: regarding the last function seo.get_serps, it has the option to change the domain, since its default is google.co.uk, I want to change it to www.google.com .我的问题:关于最后一个 function seo.get_serps,它可以选择更改域,因为它的默认值为 google.co.uk,我想将其更改为www.google.com 。 How can you specify it in the "results" line though?
你怎么能在“结果”行中指定它呢? Thank you
谢谢
results = seo.get_serps(mysearch,pages=2) While I try running this, as compare to google results, there are 1 or 2 results not matched completely.结果 = seo.get_serps(mysearch,pages=2) 当我尝试运行它时,与谷歌结果相比,有 1 或 2 个结果不完全匹配。 Therefore I was wondering how to change the domain to make it proper.
因此我想知道如何更改域以使其正确。 Thank you
谢谢
First, upgrade to the latest version of EcommerceTools by entering pip3 install --upgrade ecommercetools
首先,通过输入
pip3 install --upgrade ecommercetools
升级到最新版本的 EcommerceTools
... then, try this. ...那么,试试这个。 You'll need to set the
domain
to your preferred one and set the host_language
.您需要将
domain
设置为您喜欢的域并设置host_language
。 The domain needs to be a valid Google domain and the host_language
needs to be a valid two-letter language code, ie de
or en
.域需要是有效的 Google 域,并且
host_language
需要是有效的双字母语言代码,即de
或en
。
from ecommercetools import seo
df = seo.get_serps("bmw", pages=1, domain="google.de", host_language="de")
df
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.