如何使用GET请求从http://moz.com获取域名管理员?

问题描述 投票:0回答:1

我想从“moz.com”获得域权限值(没有找到其他来源)。有时页面无法正确加载,并且来自moz.com的响应没有我解析的正确dom元素。可能页面使用javascript来显示值。它也有限制,不能分析超过3次/天(我需要每天最多访问一次)

require 'rest-client'
require 'nokogiri'

link_url = "http://google.com"
api_url  = "http://moz.com/researchtools/ose/links?site="
response = RestClient.get(api_url + link_url.split("?").first)
value    = Nokogiri::HTML(response).css('.url-metrics-authority span.large').first.text.strip #previously there was Nokogiri::HTML(response).css('.metrics-authority').first.text.strip
pp value

从运行良好的控制台,但当我使用ruby脚本运行它时,它失败了。我可以以某种方式等待js执行或是否有任何其他来源获得域权限?

html ruby rest seo
1个回答
1
投票

您可以通过使用Moz提供的免费URL Metrics API获取任何网站/ URL的域权限。您将需要AccessId和Secret密钥来使用Mozscape API。我建议你围绕Moz API构建一个包装器API to get Moz Domain Authority,以便你可以使用Javascript中的包装器API。

© www.soinside.com 2019 - 2024. All rights reserved.