Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 如何从中获取域权限http://moz.com 使用GET请求?_Html_Ruby_Rest_Seo - Fatal编程技术网

Html 如何从中获取域权限http://moz.com 使用GET请求?

Html 如何从中获取域权限http://moz.com 使用GET请求?,html,ruby,rest,seo,Html,Ruby,Rest,Seo,我想从“moz.com”(未找到其他来源)获取域权限值。 有时页面加载不正确,来自moz.com的响应没有我解析的正确dom元素。页面可能使用javascript来显示值。它也有限制,每天不能分析超过3次(我每天最多需要访问一次) 从控制台运行,效果很好,但当我使用ruby脚本运行它时,它失败了。 我是否可以等待js执行,或者是否有其他来源获得域权限?您可以使用Moz提供的免费URL Metrics API获得任何网站/URL的域权限。使用Mozscape API需要AccessId和密钥。我建

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

从控制台运行,效果很好,但当我使用ruby脚本运行它时,它失败了。
我是否可以等待js执行,或者是否有其他来源获得域权限?

您可以使用Moz提供的免费URL Metrics API获得任何网站/URL的域权限。使用Mozscape API需要AccessId和密钥。我建议您围绕Moz API构建一个包装器,以便您可以使用Javascript中的包装器API。

我是Russ Jones,为Moz咨询。我还帮助设计了最新版本的域授权

适当的文档


获得并允许每月以不超过每10秒1次的速度进行2500次查找。付费访问从每月250美元开始,每月包括120000行,限制更少。

不能使用他们的API吗?这是付费的。它包含了很多请求,我不需要这么多。
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