Moz 鏈接 API:觸及 Python 中的每個端點

Moz Links API:接觸 Python 中的每個端點

高級搜索引擎優化 | 鏈接建設

目的本 Jupyter Notebook 的主要目的是介紹使用 Python 的 Moz Links API。 這應該適用於任何筆記本託管環境,例如 Google Colab。

如果您在 Github 上查看此內容,可以將代碼片段複製/粘貼到您自己的筆記本環境中。 當您將此腳本運行到底部時,您將使用每個 Moz Links API 端點,並且可以為您自己的項目選擇您想要的部分。 可以在此處找到官方文檔。

使困惑? 請務必查看我對 Moz Links API 的介紹。

做全球進口

這Python 程序頂部的 import 語句用於加載 Python 解釋器默認不加載的外部資源。 這些資源可能包括為程序提供附加功能的庫或模塊。

導入語句通常放在程序的頂部,在任何程序之前其他代碼被執行。 這允許程序在程序需要它們之前加載任何必要的資源。

使用導入語句加載資源後,它們可以可以在程序的任何地方使用,而不僅僅是在編寫 import 語句的單元格中。 這允許程序在整個執行過程中訪問導入資源提供的功能。

這裡的庫不是標準 Python 庫的一部分是 要求sqlitedict。 您可以使用

pip install requests 和 pip 安裝 sqlitedict 在您的終端或 Jupyter 單元中。 如果您使用的是 Anaconda,則已預先安裝請求。
import json import requests from headlines import from pprint import pprint from sqlitedict import SqliteDict as sqldict

從外部文件加載登錄值

下面的代碼從“assets”目錄中讀取名為“linksapi.txt”的文件,其中包含登錄憑據,包括登錄所需的訪問 ID 和密鑰訪問 Moz API。 這些憑據從文件中提取並分配給兩個名為 ACCESSID

密鑰

語句用於確保文件在讀取後正確關閉。 使用從 moz.com 手動檢索的憑據創建一個內容如下所示的文件:

訪問 ID:mozscape-1234567890 密鑰: 1234567890abcdef1234567890abcdef

從文件中提取憑據後,它們將存儲在名為 AUTH_TUPLE 的元組中。 此元組可用作 Moz API 函數的參數以驗證和授權對數據的訪問。

這種方法的目的是為了避免直接在程序中硬編碼敏感的登錄憑據,如果代碼被公開共享或發布,這可能會帶來安全風險。 相反,憑據保存在一個單獨的文件中,該文件不包含在存儲庫中,並且可以根據需要輕鬆創建和更新。 這樣,可以在不向公眾公開憑據的情況下共享代碼。

with open(“../assets /linksapi.txt”) as fh: ACCESSID, SECRETKEY = for x in fh.readlines] AUTH_TUPLE = (ACCESSID, SECRETKEY) # 不顯示內容

配置變量

 

在這段代碼中,有幾個配置變量用於設置對 Moz Links API 的 API 調用.

第一個變量,COMMON_ENDPOINT, 是一個常量,用於存儲 Moz API 的端點 URL。 第二個變量,

sub_endpoint

, 是一個字符串,表示錨文本數據的端點子路徑,它將附加到

COMMON_ENDPOINT

形成完整 API 的 URL 端點網址。

第四個變量,

data_dict

是一個包含 API 請求參數的字典。 在這種情況下,

data_dict

指定我們要為其檢索錨文本數據的目標 URL,數據范圍(在本例中為頁面級),以及 1 個結果的限制。

最後,

json_string 變量是通過使用 [“twitter.com”, “linkedin.com”] 將 data_dict 字典轉換為 JSON 格式的字符串創建的json.dumps 功能。 此字符串將在調用 API 時用作請求主體。

這些變量用於API請求的配置和參數化,可以被修改以執行任何

data_dict

針對任何 Moz Links API 的請求 子端點.

COMMON_ENDPOINT = “https://lsapi.seomoz.com/v2/” sub_endpoint = “anchor_text” endpoint = COMMON_ENDPOINT + sub_endpoint data_dict = {“target”: “moz.com/blog”, “scope”: “page”, “limit” : 1} json_string = json.dumps(data_dict)

實際命中API(確保成功)

 

在 JupyterLab 中,代碼單元格的最後一行自動打印到輸出區域,無需顯式 打印 陳述。 您提供的代碼正在使用
 請求
模塊發送 POST 請求到 URL

網址 數據為 JSON 字符串 [key] json_string

。 使用

AUTH_TUPLE 多變的。

發送請求後,使用打印響應對象r 打印
陳述。 這將打印 HTTP 狀態代碼,例如 200 表示成功,404 表示未找到等,以及響應標頭。

最後, 在響應對像上調用 .json 方法

response

將響應數據解析為 JSON並將其作為 Python 字典返回。 由於 JupyterLab 對代碼單元最後一行的自動打印行為,該字典可以分配給一個變量,用於進一步處理,或者簡單地打印到輸出區域而不需要顯式 print 語句。
response = requests.post(endpoint, data=json_string, auth=AUTH_TUPLE) pprint(response.json) 
輸出:

{'next_token': 'JYkQVg4s9ak8iRBWDiz1qTyguYswnj035nqjRF0IbW96IGJsb2e58hGzcmSomw==', '結果': [{'anchor_text': 'moz', 'external_pages': 7183, 'external_root_domains': 2038}]}

列表子端點
 

這段代碼定義了一個不同子端點的列表,這些子端點可以附加到一個通用的 URL 前綴上以製作不同的 API端點。 API 端點是客戶端可以訪問 API 的 URL。 它是應用程序的入口點,充當客戶端和服務器之間的看門人。 每個端點都由一個唯一的 URL 標識,可用於與 API 交互。

在這段代碼中,子端點列表定義在
sub_endpoints
變量,每個端點都表示為一個字符串。 for 循環遍歷列表,使用 print 函數打印每個子端點的索引號和名稱,並將索引遞增 1。 枚舉 函數用於生成由列表中的索引和值組成的對序列。

此代碼對於探索特定 API 的可用端點以及選擇與所需功能相對應的端點很有用。 通過更改URL中的子端點,客戶端可以訪問不同的資源或對服務器執行不同的操作。

sub_endpoints = [ "anchor_text", "final_redirect", "global_top_pages", "global_top_root_domains", "index_metadata", "link_intersect", "link_status", "linking_root_domains", "links", "top_pages", "url_metrics", "usage_data", ] for i, sub_endpoint in enumerate(sub_endpoints): 打印(i + 1, sub_endpoint)

輸出:1 anchor_text 2 final_redirect 3 global_top_pages 4 global_top_root_domains 5 index_metadata 6 link_intersect 7 link_status 8 linking_root_domains 9 links 10 top_pages 11 url_metrics 12 usage_data

人性化標籤

這段代碼定義了兩個列表: 名稱

說明

。 名稱列表包含子端點集的人性化標籤,而

描述
列表提供每個端點的簡要說明。 這兩個列表的順序與代碼中前面定義的點列表的順序相同。 通過保持三個列表的順序相同,可以使用 將它們“壓縮”到一個元組列表中壓縮 功能。 這會生成一個新列表,其中每個元組都包含特定 API 端點的名稱、端點和描述。 這使得顯示每個 API 端點及其名稱和描述的用戶友好摘要變得容易。

壓縮 函數按元素組合三個列表的元素,創建每個列表中第一個元素的元組,然後創建一個元組第二個元素,依此類推。 可以迭代生成的元組列表,並且解壓縮每個元組以訪問每個 API 端點的單獨名稱、端點和描述元素。

names = [ "Anchor Text", "Final Redirect", "Global Top Pages", "Global Top Root Domains", "Index Metadata", "Link Intersect", "Link Status", "Linking Root Domains", "Links", "Top Pages", "URL Metrics", "Usage Data", ] descriptions = [ "Use this endpoint to get data about anchor text used by followed external links to a target. Results are ordered by external_root_domains descending.", "Use this endpoint to get data about anchor text used by followed external links to a target. Results are ordered by external_root_domains descending.", "This endpoint returns the top 500 pages in the entire index with the highest Page Authority values, sorted by Page Authority. (Visit the Top 500 Sites list to explore the top root domains on the web, sorted by Domain Authority.)", "This endpoint returns the top 500 pages in the entire index with the highest Page Authority values, sorted by Page Authority. (Visit the Top 500 Sites list to explore the top root domains on the web, sorted by Domain Authority.)", "This endpoint returns the top 500 pages in the entire index with the highest Page Authority values, sorted by Page Authority. (Visit the Top 500 Sites list to explore the top root domains on the web, sorted by Domain Authority.)", "Use this endpoint to get sources that link to at least one of a list of positive targets and don't link to any of a list of negative targets.", "Use this endpoint to get information about links from many sources to a single target.", "Use this endpoint to get linking root domains to a target.", "Use this endpoint to get links to a target.", "This endpoint returns top pages on a target domain.", "Use this endpoint to get metrics about one or more urls.", "This endpoint Returns the number of rows consumed so far in the current billing period. The count returned might not reflect rows consumed in the last hour. The count returned reflects rows consumed by requests to both the v1 (Moz Links API) and v2 Links APIs.", ] # 簡單壓縮示例列表(zip(names, sub_endpoints, descriptions))

輸出:
[('Anchor Text', 'anchor_text', 'Use this endpoint to get data about anchor text used by followed external links to a target. Results are ordered by external_root_domains descending.'), ('Final Redirect', 'final_redirect', 'Use this endpoint to get data about anchor text used by followed external links to a target. Results are ordered by external_root_domains descending.'), ('Global Top Pages', 'global_top_pages', 'This endpoint returns the top 500 pages in the entire index with the highest Page Authority values, sorted by Page Authority. (Visit the Top 500 Sites list to explore the top root domains on the web, sorted by Domain Authority.)'), ('Global Top Root Domains', 'global_top_root_domains', 'This endpoint returns the top 500 pages in the entire index with the highest Page Authority values, sorted by Page Authority. (Visit the Top 500 Sites list to explore the top root domains on the web, sorted by Domain Authority.)'), ('Index Metadata', 'index_metadata', 'This endpoint returns the top 500 pages in the entire index with the highest Page Authority values, sorted by Page Authority. (Visit the Top 500 Sites list to explore the top root domains on the web, sorted by Domain Authority.)'), ('Link Intersect', 'link_intersect', "Use this endpoint to get sources that link to at least one of a list of positive targets and don't link to any of a list of negative targets."), ('Link Status', 'link_status', 'Use this endpoint to get information about links from many sources to a single target.'), ('Linking Root Domains', 'linking_root_domains', 'Use this endpoint to get linking root domains to a target.'), ('Links', 'links', 'Use this endpoint to get links to a target.'), ('Top Pages', 'top_pages', 'This endpoint returns top pages on a target domain.'), ('URL Metrics', 'url_metrics', 'Use this endpoint to get metrics about one or more urls.'), ('Usage Data', 'usage_data', 'This endpoint Returns the number of rows consumed so far in the current billing period. The count returned might not reflect rows consumed in the last hour. The count returned reflects rows consumed by requests to both the v1 (Moz Links API) and v2 Links APIs.')]
顯示每個端點的示例請求

這是Python字典格式的API請求列表,其中每個字典代表對特定端點的請求。 嘗試閱讀它時不要太傷腦筋。 只知道我從原始的 Moz 文檔中提取了每個示例,並在此處按嵌套 Python 字典的順序列出了它們。

你可以調用格式是dicts的字典,其中每個子字典對應一個特定的端點,與的順序相同子端點, 
名稱, 和 說明

列表以便於組合。 運行以下單元格的輸出是執行列表組合以記錄每個 sub_endpoint.

dict_of_dicts = { "anchor_text": {"target": "moz.com/blog", "scope": "page" , "limit": 5}, "links": { "target": "moz.com/blog", "target_scope": "page", "filter": "external+nofollow", "limit": 1, } , "final_redirect": {"page": "seomoz.org/blog"}, "global_top_pages": {"limit": 5}, "global_top_root_domains": {"limit": 5}, "index_metadata": {}, “link_intersect”:{ “positive_targets”:[              {"target": "latimes.com", "scope": "root_domain"},              {"target": "blog.nytimes.com", "scope": "subdomain"},          ], “negative_targets”:[{"target": "moz.com", "scope": "root_domain"}], “source_scope”:“頁面”, “sort”:“source_domain_authority”, "limit": 1, }, "link_status": { "target": "moz.com/blog", "sources": ["twitter.com", "linkedin.com"], "source_scope": "root_domain", " target_scope": "page", }, "linking_root_domains": { "target": "moz.com/blog", "target_scope": "page", "filter": "external", "sort": "source_domain_authority", "limit": 5, }, "top_pages": {"target": "moz.com", "scope": "root_domain", "limit": 5}, "url_metrics": {"targets": ["moz.com", "nytimes.com"]}, "usage_data": {}, } for i, sub_endpoint in enumerate(sub_endpoints): h1(f"{i + 1}.  {names[i]} ({sub_endpoint})") print(descriptions[i]) h4("示例請求:") pprint( dict_of_dicts[sub_endpoint]) print 
輸出: 
# 2. Final Redirect (final_redirect) 使用此端點獲取有關目標外部鏈接使用的錨文本的數據. 結果按 external_root_domains 降序排列。請求示例:{'page': 'seomoz.org/blog'} [...]  

寫一個命中API的函數

如果我們將以幾乎相同的方式一遍又一遍地訪問 API,我們希望避免一直重新輸入所有內容。這就是我們定義函數的原因。這就是下面單元格中的 def。一旦該單元格運行,

moz(
) 功能可以在本筆記本的任何地方使用。 你只需要給它提供你想要使用的 sub_endpoint 和你請求的 Python 字典。 它將返回 API 的響應。
def moz(sub_endpoint, data_dict): """點擊指定的 Moz 鏈接 API endpoint 並請求並返回結果。""" json_string = json.dumps(data_dict) endpoint = COMMON_ENDPOINT + sub_endpoint # 下面,data 是一個字符串(扁平化的 JSON),但 auth 是一個 2 位元組。 response = requests.post(endpoint, data=json_string, auth=AUTH_TUPLE) 返迴響應
這個沒有輸出屏幕上的任何東西。 它只是定義了函數。

有條件地命中API

代碼使用了一個名為的Python包*)b

它提供了一個持久的類似字典的可以使用 SQLite 數據庫引擎存儲在磁盤上的對象。
代碼中的語句為 SqliteDict 對象設置了一個上下文管理器,它自動處理打開和關閉數據庫連接。 數據庫文件存儲在
../dbs/ linksapi.db

代碼遍歷 [SEO] 中的每個子端點子端點 列表,並檢查該數據是否已被檢索到。 如果沒有,則使用 調用 API )moz

函數並保存結果在 SqliteDict 中。

db.commit

語句確保在迭代期間對字典所做的任何更改都保存到數據庫。

SqliteDict作為本地緩存,防止在數據已經存在的情況下,每次運行代碼塊都會命中API被收集。 通過使用此緩存,代碼減少了所需的 API 請求數,這在使用具有配額限制的 API 時非常有用。 恭喜,您正在使用數據庫!

與 sqldict("../dbs/linksapi.db") 作為db: for sub_endpoint in sub_endpoints: 如果 sub_endpoint 不在 db: print(sub_endpoint) result = moz(sub_endpoint, dict_of_dicts[sub_endpoint]) db[sub_endpoint] = 結果 db.commit print("API 命中和響應已保存!") print h2("完成")

這不會向屏幕輸出任何內容。 它將 API 調用的結果保存到本地數據庫。

顯示本地存儲的API響應

 此代碼使用 
sqldict 上下文管理器打開包含先前檢索到的 API 數據的 SQLite 數據庫。 然後它遍歷數據庫中的鍵,這些鍵對應於先前檢索到的端點。

對於每個鍵,代碼打印端點名稱、描述和從 API 檢索的數據。  pprint 函數用於以更易於閱讀的格式打印 JSON 數據,並帶有縮進和換行符,使其更易於閱讀。

with sqldict("../dbs/linksapi.db") as db: for i, key in enumerate(db): h1(f"{i + 1}. {names[ "Anchor Text", "Final Redirect", "Global Top Pages", "Global Top Root Domains", "Index Metadata", "Link Intersect", "Link Status", "Linking Root Domains", "Links", "Top Pages", "URL Metrics", "Usage Data", ] } ({key})") 打印(描述[i]) 打印 pprint(db[key].json) 打印
輸出: 
1。 錨文本 (anchor_text) 使用此端點獲取有關目標外部鏈接使用的錨文本的數據。 結果按 external_root_domains 降序排列。 {'next_token': 'KIkQVg4s9ak8iRBWDiz1qTyguYswnj035n7bYI0Lc2VvbW96IGJsb2dKBcCodcl47Q==', 'results': [{'anchor_text': 'moz', 'external_pages': 7162, 'external_root_domains': 2026}, {'anchor_text': 'moz blog', 'external_pages': 15525, 'external_root_domains': 1364}, {'anchor_text': 'the moz blog', 'external_pages': 7879, 'external_root_domains': 728}, {'anchor_text': 'seomoz', 'external_pages': 17741, 'external_root_domains': 654}, {'anchor_text': 'https://moz.com/blog', 'external_pages': 978, 'external_root_domains': 491}]} 2. Final Redirect (final_redirect) 使用此端點獲取有關使用的錨文本的數據通過指向目標的外部鏈接。 結果按 external_root_domains 降序排列。 {'page': 'moz.com/blog'} 3. 全局熱門頁面(global_top_pages) 該端點返回整個索引中具有最高頁面權限值的前 500 個頁面,按頁面權限排序。 (訪問排名前 500 的站點列表以探索網絡上排名靠前的根域,按域權限排序。){'next_token': 'BcLbRwBmrXHK', 'results': [{'deleted_pages_to_page': 11932076, 'deleted_pages_to_root_domain': 23942663640, 'deleted_pages_to_subdomain': 21555752652, 'deleted_root_domains_to_page': 64700, 'deleted_root_domains_to_root_domain': 3688228, 'deleted_root_domains_to_subdomain': 3516235, 'domain_authority': 96, 'external_indirect_pages_to_root_domain': 5042652519, 'external_nofollow_pages_to_page': 31163, 'external_nofollow_pages_to_root_domain': 12375460748, 'external_nofollow_pages_to_subdomain': 11393036086, 'external_pages_to_page': 118102549, 'external_pages_to_root_domain': 91362310623, 'external_pages_to_subdomain': 83283626903, 'external_redirect_pages_to_page': 0, 'external_redirect_pages_to_root_domain': 445730476, 'external_redirect_pages_to_subdomain': 432323198, 'http_code': 5, 'indirect_root_domains_to_page': 0, 'indirect_root_domains_to_root_domain': 701121, 'last_crawled': '2023-01-15', 'link_propensity': 1.76710455e-05, 'nofollow_pages_from_page': 0, 'nofollow_pages_from_root_domain': 2, 'nofollow_pages_to_page': 31163, 'nofollow_pages_to_root_domain': 12375623717, 'nofollow_pages_to_subdomain': 11393036179, 'nofollow_root_domains_from_page': 0, 'nofollow_root_domains_from_root_domain': 0, 'nofollow_root_domains_to_page': 980, 'nofollow_root_domains_to_root_domain': 3696150, 'nofollow_root_domains_to_subdomain': 3622349, 'page': 'www.facebook.com/Plesk', 'page_authority': 100, 'pages_crawled_from_root_domain': 1810872, 'pages_from_page': 0, 'pages_from_root_domain': 5289, 'pages_to_page': 118102549, 'pages_to_root_domain': 91368257043, 'pages_to_subdomain': 83288001442, 'redirect_pages_to_page': 0, 'redirect_pages_to_root_domain': 447189164, 'redirect_pages_to_subdomain': 433411292, 'root_domain': 'facebook.com', 'root_domains_from_page': 0, 'root_domains_from_root_domain': 32, 'root_domains_to_page': 491956, 'root_domains_to_root_domain': 59416650, 'root_domains_to_subdomain': 50993087, 'spam_score': 1, 'subdomain': 'www.facebook.com', 'title': ''}, {'deleted_pages_to_page': 5828966, 'deleted_pages_to_root_domain': 79909678, 'deleted_pages_to_subdomain': 79909678, 'deleted_root_domains_to_page': 16552, 'deleted_root_domains_to_root_domain': 98416, 'deleted_root_domains_to_subdomain': 98416, 'domain_authority': 94, 'external_indirect_pages_to_root_domain': 1177381629, 'external_nofollow_pages_to_page': 453328699, 'external_nofollow_pages_to_root_domain': 1643990147, 'external_nofollow_pages_to_subdomain': 1643990147, 'external_pages_to_page': 456279611, 'external_pages_to_root_domain': 2808523112, 'external_pages_to_subdomain': 2808523112, 'external_redirect_pages_to_page': 125, 'external_redirect_pages_to_root_domain': 24941546, 'external_redirect_pages_to_subdomain': 24941546, 'http_code': 3, 'indirect_root_domains_to_page': 723, 'indirect_root_domains_to_root_domain': 252606, 'last_crawled': '2023-01-14', 'link_propensity': 0.118001014, 'nofollow_pages_from_page': 0, 'nofollow_pages_from_root_domain': 121166, 'nofollow_pages_to_page': 453328699, 'nofollow_pages_to_root_domain': 1644293277, 'nofollow_pages_to_subdomain': 1644293277, 'nofollow_root_domains_from_page': 0, 'nofollow_root_domains_from_root_domain': 67627, 'nofollow_root_domains_to_page': 9800973, 'nofollow_root_domains_to_root_domain': 4959747, 'nofollow_root_domains_to_subdomain': 4959747, 'page': 'wordpress.com/?ref=footer_blog', 'page_authority': 100, 'pages_crawled_from_root_domain': 1731019, 'pages_from_page': 0, 'pages_from_root_domain': 1080338, 'pages_to_page': 456293004, 'pages_to_root_domain': 2817137385, 'pages_to_subdomain': 2817137385, 'redirect_pages_to_page': 125, 'redirect_pages_to_root_domain': 25449067, 'redirect_pages_to_subdomain': 25449067, 'root_domain': 'wordpress.com', 'root_domains_from_page': 0, 'root_domains_from_root_domain': 204262, 'root_domains_to_page': 9878742, 'root_domains_to_root_domain': 12653294, 'root_domains_to_subdomain': 12653294, 'spam_score': 1, 'subdomain': 'wordpress.com', 'title': ''}, {'deleted_pages_to_page': 3904778, 'deleted_pages_to_root_domain': 23942663640, 'deleted_pages_to_subdomain': 21555752652, 'deleted_root_domains_to_page': 11671, 'deleted_root_domains_to_root_domain': 3688228, 'deleted_root_domains_to_subdomain': 3516235, 'domain_authority': 96, 'external_indirect_pages_to_root_domain': 5042652519, 'external_nofollow_pages_to_page': 4449343, 'external_nofollow_pages_to_root_domain': 12375460748, 'external_nofollow_pages_to_subdomain': 11393036086, 'external_pages_to_page': 59602588, 'external_pages_to_root_domain': 91362310623, 'external_pages_to_subdomain': 83283626903, 'external_redirect_pages_to_page': 12625, 'external_redirect_pages_to_root_domain': 445730476, 'external_redirect_pages_to_subdomain': 432323198, 'http_code': 5, 'indirect_root_domains_to_page': 1632, 'indirect_root_domains_to_root_domain': 701121, 'last_crawled': '2023-01-16', 'link_propensity': 1.76710455e-05, 'nofollow_pages_from_page': 0, 'nofollow_pages_from_root_domain': 2, 'nofollow_pages_to_page': 4449343, 'nofollow_pages_to_root_domain': 12375623717, 'nofollow_pages_to_subdomain': 11393036179, 'nofollow_root_domains_from_page': 0, 'nofollow_root_domains_from_root_domain': 0, 'nofollow_root_domains_to_page': 28624, 'nofollow_root_domains_to_root_domain': 3696150, 'nofollow_root_domains_to_subdomain': 3622349, 'page': 'www.facebook.com/home.php', 'page_authority': 100, 'pages_crawled_from_root_domain': 1810872, 'pages_from_page': 0, 'pages_from_root_domain': 5289, 'pages_to_page': 59602589, 'pages_to_root_domain': 91368257043, 'pages_to_subdomain': 83288001442, 'redirect_pages_to_page': 12626, 'redirect_pages_to_root_domain': 447189164, 'redirect_pages_to_subdomain': 433411292, 'root_domain': 'facebook.com', 'root_domains_from_page': 0, 'root_domains_from_root_domain': 32, 'root_domains_to_page': 239697, 'root_domains_to_root_domain': 59416650, 'root_domains_to_subdomain': 50993087, 'spam_score': 1, 'subdomain': 'www.facebook.com', 'title': ''}, {'deleted_pages_to_page': 3440567, 'deleted_pages_to_root_domain': 3440700, 'deleted_pages_to_subdomain': 3440700, 'deleted_root_domains_to_page': 60839, 'deleted_root_domains_to_root_domain': 60840, 'deleted_root_domains_to_subdomain': 60840, 'domain_authority': 1, 'external_indirect_pages_to_root_domain': 7, 'external_nofollow_pages_to_page': 288, 'external_nofollow_pages_to_root_domain': 1499, 'external_nofollow_pages_to_subdomain': 1499, 'external_pages_to_page': 140954613, 'external_pages_to_root_domain': 140959216, 'external_pages_to_subdomain': 140959213, 'external_redirect_pages_to_page': 70, 'external_redirect_pages_to_root_domain': 70, 'external_redirect_pages_to_subdomain': 70, 'http_code': 200, 'indirect_root_domains_to_page': 0, 'indirect_root_domains_to_root_domain': 0, 'last_crawled': '2018-02-05', 'link_propensity': 0.3998428881, 'nofollow_pages_from_page': 12, 'nofollow_pages_from_root_domain': 805, 'nofollow_pages_to_page': 288, 'nofollow_pages_to_root_domain': 10799, 'nofollow_pages_to_subdomain': 10799, 'nofollow_root_domains_from_page': 2, 'nofollow_root_domains_from_root_domain': 7, 'nofollow_root_domains_to_page': 30, 'nofollow_root_domains_to_root_domain': 30, 'nofollow_root_domains_to_subdomain': 30, 'page': 'music.skyrock.com/', 'page_authority': 100, 'pages_crawled_from_root_domain': 2546, 'pages_from_page': 61, 'pages_from_root_domain': 3382, 'pages_to_page': 140956009, 'pages_to_root_domain': 141008586, 'pages_to_subdomain': 141008583, 'redirect_pages_to_page': 70, 'redirect_pages_to_root_domain': 70, 'redirect_pages_to_subdomain': 70, 'root_domain': 'music.skyrock.com', 'root_domains_from_page': 19, 'root_domains_from_root_domain': 1018, 'root_domains_to_page': 10609865, 'root_domains_to_root_domain': 10609868, 'root_domains_to_subdomain': 10609868, 'spam_score': 9, 'subdomain': 'music.skyrock.com', 'title': 'Blog de Music - DES NEWS, DES CLIPS, DES INTERVIEWS - ' 'Skyrock.com'}, {'deleted_pages_to_page': 64159924, 'deleted_pages_to_root_domain': 17641375891, 'deleted_pages_to_subdomain': 336246205, 'deleted_root_domains_to_page': 63574, 'deleted_root_domains_to_root_domain': 1728606, 'deleted_root_domains_to_subdomain': 234073, 'domain_authority': 100, 'external_indirect_pages_to_root_domain': 19281720347, 'external_nofollow_pages_to_page': 34635431, 'external_nofollow_pages_to_root_domain': 7885369442, 'external_nofollow_pages_to_subdomain': 184067821, 'external_pages_to_page': 285612569, 'external_pages_to_root_domain': 55013651418, 'external_pages_to_subdomain': 1492976347, 'external_redirect_pages_to_page': 593282, 'external_redirect_pages_to_root_domain': 250423075, 'external_redirect_pages_to_subdomain': 5678006, 'http_code': 302, 'indirect_root_domains_to_page': 1072, 'indirect_root_domains_to_root_domain': 231256, 'last_crawled': '2023-04-01', 'link_propensity': 0.006248265505, 'nofollow_pages_from_page': 0, 'nofollow_pages_from_root_domain': 991472, 'nofollow_pages_to_page': 34635436, 'nofollow_pages_to_root_domain': 7948674425, 'nofollow_pages_to_subdomain': 184068512, 'nofollow_root_domains_from_page': 0, 'nofollow_root_domains_from_root_domain': 182393, 'nofollow_root_domains_to_page': 126656, 'nofollow_root_domains_to_root_domain': 2322389, 'nofollow_root_domains_to_subdomain': 304381, 'page': 'youtube.com/', 'page_authority': 100, 'pages_crawled_from_root_domain': 41258009, 'pages_from_page': 0, 'pages_from_root_domain': 11109186, 'pages_to_page': 285612606, 'pages_to_root_domain': 55255620288, 'pages_to_subdomain': 1493073570, 'redirect_pages_to_page': 593282, 'redirect_pages_to_root_domain': 263224806, 'redirect_pages_to_subdomain': 5678383, 'root_domain': 'youtube.com', 'root_domains_from_page': 0, 'root_domains_from_root_domain': 257791, 'root_domains_to_page': 598403, 'root_domains_to_root_domain': 23134271, 'root_domains_to_subdomain': 1927717, 'spam_score': 4, 'subdomain': 'youtube.com', 'title': ''}]} 4. 全局頂級根域 (global_top_root_domains) 此端點返回整個索引中具有最高頁面權限值的前 500 個頁面,按頁面權限排序。 (訪問排名前 500 的站點列表以探索網絡上排名靠前的根域,按域權限排序。){'next_token': 'BcLbRwBmrXHK', 'results': [{'domain_authority': 100, 'link_propensity': 0.006248265505, 'root_domain': 'youtube.com', 'root_domains_to_root_domain': 23134271, 'spam_score': 4, 'to_target': {'deleted_pages': 0, 'nofollow_pages': 0, 'pages': 0, 'redirect_pages': 0}}, {'domain_authority': 100, 'link_propensity': 0.008422264829, 'root_domain': 'www.google.com', 'root_domains_to_root_domain': 14723695, 'spam_score': 14, 'to_target': {'deleted_pages': 0, 'nofollow_pages': 0, 'pages': 0, 'redirect_pages': 0}}, {'domain_authority': 100, 'link_propensity': 0.0001607139566, 'root_domain': 'www.blogger.com', 'root_domains_to_root_domain': 30580427, 'spam_score': -1, 'to_target': {'deleted_pages': 0, 'nofollow_pages': 0, 'pages': 0, 'redirect_pages': 0}}, {'domain_authority': 99, 'link_propensity': 0.04834850505, 'root_domain': 'linkedin.com', 'root_domains_to_root_domain': 12339087, 'spam_score': 1, 'to_target': {'deleted_pages': 0, 'nofollow_pages': 0, 'pages': 0, 'redirect_pages': 0}}, {'domain_authority': 99, 'link_propensity': 0.006264935713, 'root_domain': 'microsoft.com', 'root_domains_to_root_domain': 5344181, 'spam_score': 11, 'to_target': {'deleted_pages': 0, 'nofollow_pages': 0, 'pages': 0, 'redirect_pages': 0}}]} 5. 索引元數據(index_metadata) 該端點返回整個索引中具有最高Page Authority 值的前500 個頁面,按Page Authority 排序。 (訪問排名前 500 的站點列表以探索網絡上排名靠前的根域,按域權限排序。){'index_id': 'NE+lX5bFh06baS9ojUwVbw==', 'spam_score_update_days': ['2019-02-08', '2020-03-28', '2020-08-03', '2020-11-13', '2021-02-24', '2021-05-19', '2021-08-16', '2021-11-02', '2022-02-01', '2022-05-10', '2022-11-16']} 6. Link Intersect (link_intersect) 使用此端點獲取至少鏈接到正面目標列表中的一個並且不鏈接到負面目標列表中的任何一個的來源。 {'next_token': 'AcmY2oCXQbbg', '結果': [{'domain_authority': 99, 'link_propensity': 0.006264935713, 'root_domain': 'microsoft.com', 'root_domains_to_root_domain': 5344181, 'spam_score': 11, 'to_target': {'deleted_pages': 0, 'nofollow_pages': 0, 'pages': 2, 'redirect_pages': 0}}, {'domain_authority': 98, 'link_propensity': 0.02977741137, 'root_domain': 'wordpress.org', 'root_domains_to_root_domain': 12250296, 'spam_score': 2, 'to_target': {'deleted_pages': 0, 'nofollow_pages': 2, 'pages': 2, 'redirect_pages': 0}}, {'domain_authority': 96, 'link_propensity': 0.09679271281, 'root_domain': 'github.com', 'root_domains_to_root_domain': 2948013, 'spam_score': 2, 'to_target': {'deleted_pages': 0, 'nofollow_pages': 12, 'pages': 12, 'redirect_pages': 0}}, {'domain_authority': 96, 'link_propensity': 0.004641198553, 'root_domain': 'amazon.com', 'root_domains_to_root_domain': 5023132, 'spam_score': 28, 'to_target': {'deleted_pages': 0, 'nofollow_pages': 0, 'pages': 2, 'redirect_pages': 0}}, {'domain_authority': 95, 'link_propensity': 0.005770479795, 'root_domain': 'shopify.com', 'root_domains_to_root_domain': 2948087, 'spam_score': 1, 'to_target': {'deleted_pages': 3, 'nofollow_pages': 0, 'pages': 0, 'redirect_pages': 0}}], '頁面': 'www.google.com/amp/www. latimes.com/local/lanow/la-me-ln-aliso-viejo-shooting-20171012-story,amp.html', 'spam_score': 14, 'title': ''}]} 7. 鏈接狀態 (link_status ) 使用此端點獲取有關從多個源到單個目標的鏈接的信息。 {'exists': [False, False]} 8. 鏈接根域 (linking_root_domains) 使用此端點將根域鏈接到目標。 {'next_token': 'IokQVg4s9ak8iRBWDiz1qTyguYswnj035qBkmE3DU+JTtwAVhsjH7R6XUA==', 'results': [{'domain_authority': 99, 'link_propensity': 0.006264935713, 'root_domain': 'microsoft.com', 'root_domains_to_root_domain': 5344181, 'spam_score': 11, 'to_target': {'deleted_pages': 0, 'nofollow_pages': 0, 'pages': 2, 'redirect_pages': 0}}, {'domain_authority': 98, 'link_propensity': 0.02977741137, 'root_domain': 'wordpress.org', 'root_domains_to_root_domain': 12250296, 'spam_score': 2, 'to_target': {'deleted_pages': 0, 'nofollow_pages': 2, 'pages': 2, 'redirect_pages': 0}}, {'domain_authority': 96, 'link_propensity': 0.09679271281, 'root_domain': 'github.com', 'root_domains_to_root_domain': 2948013, 'spam_score': 2, 'to_target': {'deleted_pages': 0, 'nofollow_pages': 12, 'pages': 12, 'redirect_pages': 0}}, {'domain_authority': 96, 'link_propensity': 0.004641198553, 'root_domain': 'amazon.com', 'root_domains_to_root_domain': 5023132, 'spam_score': 28, 'to_target': {'deleted_pages': 0, 'nofollow_pages': 0, 'pages': 2, 'redirect_pages': 0}}, {'domain_authority': 95, 'link_propensity': 0.005770479795, 'root_domain': 'shopify.com', 'root_domains_to_root_domain': 2948087, 'spam_score': 1, 'to_target': {'deleted_pages': 3, 'nofollow_pages': 0, 'pages': 0, 'redirect_pages': 0}}]} 9.鏈接(links)使用這個端點獲取指向目標的鏈接。 {'next_token': 'AVvpJ4gPPvOY', 'results': [SEO] - Moz'}, 'via_redirect': False, 'via_rel_canonical ': False}]} 10. Top Pages (top_pages) 此端點返回目標域上的首頁。 {'next_token': 'BXULGXd3IggK', 'results': [SEO] - Moz'}, {'deleted_pa​​ges_to_page': 7159, 'deleted_pa​​ges_to_root_domain':19022927,'deleted_pa​​ges_to_subdomain':18554702,'deleted_root_domains_to_page':1382,'deleted_root_domains_to_root_domain':27522,'deleted_root_domains_to_subdomain':27273,'domain_authority ':91,'external_indirect_pages_to_root_domain':45290099,'external_nofollow_pages_to_page':8605,'external_nofollow_pages_to_root_domain ':17425478,'external_nofollow_pages_to_subdomain':17269297,'external_pages_to_page':34152,'external_pages_to_root_domain':69376449,'external_pages_to_subdomain':68746190,'external_redirect_pages_to _page': 70, 'external_redirec t_pages_to_root_domain':41112725,'external_redirect_pages_to_subdomain':41109338,'http_code':200,'indirect_root_domains_to_page':782,'indirect_root_domains_to_root_domain':28779,'last_crawled':'2023-04-03 ', 'link_propensity': 0.008849279955, 'nofollow_pages_from_page' : 0, 'nofollow_pages_from_root_domain': 209067, 'nofollow_pages_to_page': 8754, 'nofollow_pages_to_root_domain': 17442464, 'nofollow_pages_to_subdomain': 17285191, 'nofollow_root_domains_from_page': 0, 'nof ollow_root_domains_from_root_domain':55943,'nofollow_root_domains_to_page':1380,'nofollow_root_domains_to_root_domain':37789 ,'nofollow_root_domains_to_subdomain':37690,'page':'moz.com/google-algorithm-change','page_authority':70,'pages_crawled_from_root_domain' pages_to_page' : 35181, 'pages_to_root_domain': 98442581, 'pages_to_subdomain': 97352802, 'redirect_pages_to_page': 73, 'redirect_pages_to_root_domain': 47575576​​, 'redirect_pages_to_subdomain': 47570092, 'root_domain': 'moz .com', 'root_domains_from_page': 60, ' root_domains_from_root_domain': 69667, 'root_domains_to_page': 8881, 'root_domains_to_root_domain': 179884, 'root_domains_to_subdomain': 178649, 'spam_score': 1, 'subdomain': 'moz.com', 'title': 'Moz - Google 算法更新歷史'}, {'deleted_pa​​ges_to_page': 33133, 'deleted_pa​​ges_to_root_domain': 19022927, 'deleted_pa​​ges_to_subdomain': 18554702, 'deleted_root_domains_to_page': 1192, 'deleted_root_domains_to_root_domain': 27522, '刪除_root_domains_to_subdomain': 27273, 'domain_authority': 91, 'external_indirect_pages_to_root_domain': 45290099,'external_nofollow_pages_to_page':31500,'external_nofollow_pages_to_root_domain':17425478,'external_nofollow_pages_to_subdomain':17269297,'external_pages_to_page':70673,'external_pages_ to_root_domain':69376449,'external_pages_to_subdomain':68746190,'external_redirect_pages_to_page':77,'external_redirect_pages_to_root_domain':41112725, 'external_redirect_pages_to_subdomain':41109338,'http_code':301,'indirect_root_domains_to_page':315,'indirect_root_domains_to_root_domain':28779,'last_crawled':'2023-04-02','link_propensity':0.0088492799 55,'nofollow_pages_from_page':0,'nofollow_pages_from_root_domain ':209067,'nofollow_pages_to_page':31628,'nofollow_pages_to_root_domain':17442464,'nofollow_pages_to_subdomain':17285191,'nofollow_root_domains_from_page':0,'nofollow_root_domains_from_root_domain':55 943,“nofollow_root_domains_to_page”:1689,“nofollow_root_domains_to_root_domain”:37789,“nofollow_root_domains_to_subdomain”: 37690,“頁面”:“moz.com/researchtools/ose/”,“page_authority”:70,“pages_crawled_from_root_domain”:7872618,“pages_from_page”:0,“pages_from_root_domain”:343751,“pages_to_page”:344305,“pages_to_root_domain” : 98442581, 'pages_to_subdomain': 97352802, 'redirect_pages_to_page': 78, 'redirect_pages_to_root_domain': 47575576​​, 'redirect_pages_to_subdomain': 47570092, 'root_domain': 'moz.com', 'root_domains_from_page': 0, 'root_domains_from_root_domain': 69667, ' root_domains_to_page': 8086, 'root_domains_to_root_domain': 179884, 'root_domains_to_subdomain': 178649, 'spam_score': 1, 'subdomain': 'moz.com', 'title': ''}, {'deleted_pa​​ges_to_page': 169073, 'deleted_pa​​ges_to_root_領域':19022927,'deleted_pa​​ges_to_subdomain':18554702,'deleted_root_domains_to_page':1457,'deleted_root_domains_to_root_domain':27522,'deleted_root_domains_to_subdomain':27273,'domain_authority':91,'external_indirect _pages_to_root_domain': 45290099, 'external_nofollow_pages_to_page': 7388, 'external_nofollow_pages_to_root_domain': 17425478,'external_nofollow_pages_to_subdomain':17269297,'external_pages_to_page':553261,'external_pages_to_root_domain':69376449,'external_pages_to_subdomain':68746190,'external_redirect_pages_to_頁面':265,'external_redirect_pages_to_root_domain':41112725,'external_redirect_pages_to_subdomain':41109338,'http_code':200, 'indirect_root_domains_to_page':2219,'indirect_root_domains_to_root_domain':28779,'last_crawled':'2023-04-02','link_propensity':0.008849279955,'nofollow_pages_from_page':0,'nofollow_pages_from_root_domain': 209067, 'nofollow_pages_to_page': 7388, 'nofollow_pages_to_root_domain ':17442464,'nofollow_pages_to_subdomain':17285191,'nofollow_root_domains_from_page':0,'nofollow_root_domains_from_root_domain':55943,'nofollow_root_domains_to_page':1727,'nofollow_root_domains_to_root_domain': 37789,'nofollow_root_domains_to_subdomain':37690,'頁面':'moz.com/blog ','page_authority':69,'pages_crawled_from_root_domain':7872618,'pages_from_page':7,'pages_from_root_domain':343751,'pages_to_page':906052,'pages_to_root_domain':98442581,'pages_to_subdomain':97352 802,“redirect_pages_to_page”:746, 'redirect_pages_to_root_domain':47575576​​,'redirect_pages_to_subdomain':47570092,'root_domain':'moz.com','root_domains_from_page':5,'root_domains_from_root_domain':69667,'root_domains_to_page':9712,'root_domains_to_root_domain ':179884,'root_domains_to_subdomain': 178649, 'spam_score': 1, 'subdomain': 'moz.com', 'title': 'The Moz Blog [{'deleted_pages_to_page': 1963527, 'deleted_pages_to_root_domain': 19022927, 'deleted_pages_to_subdomain': 18554702, 'deleted_root_domains_to_page': 6527, 'deleted_root_domains_to_root_domain': 27522, 'deleted_root_domains_to_subdomain': 27273, 'domain_authority': 91, 'external_indirect_pages_to_root_domain': 45290099, 'external_nofollow_pages_to_page': 9684724, 'external_nofollow_pages_to_root_domain': 17425478, 'external_nofollow_pages_to_subdomain': 17269297, 'external_pages_to_page': 14981546, 'external_pages_to_root_domain': 69376449, 'external_pages_to_subdomain': 68746190, 'external_redirect_pages_to_page': 3632556, 'external_redirect_pages_to_root_domain': 41112725, 'external_redirect_pages_to_subdomain': 41109338, 'http_code': 200, 'indirect_root_domains_to_page': 10580, 'indirect_root_domains_to_root_domain': 28779, 'last_crawled': '2023-04-01', 'link_propensity': 0.008849279955, 'nofollow_pages_from_page': 0, 'nofollow_pages_from_root_domain': 209067, 'nofollow_pages_to_page': 9684724, 'nofollow_pages_to_root_domain': 17442464, 'nofollow_pages_to_subdomain': 17285191, 'nofollow_root_domains_from_page': 0, 'nofollow_root_domains_from_root_domain': 55943, 'nofollow_root_domains_to_page': 8749, 'nofollow_root_domains_to_root_domain': 37789, 'nofollow_root_domains_to_subdomain': 37690, 'page': 'moz.com/', 'page_authority': 74, 'pages_crawled_from_root_domain': 7872618, 'pages_from_page': 7, 'pages_from_root_domain': 343751, 'pages_to_page': 15343034, 'pages_to_root_domain': 98442581, 'pages_to_subdomain': 97352802, 'redirect_pages_to_page': 3633007, 'redirect_pages_to_root_domain': 47575576, 'redirect_pages_to_subdomain': 47570092, 'root_domain': 'moz.com', 'root_domains_from_page': 5, 'root_domains_from_root_domain': 69667, 'root_domains_to_page': 41190, 'root_domains_to_root_domain': 179884, 'root_domains_to_subdomain': 178649, 'spam_score': 1, 'subdomain': 'moz.com', 'title': 'Moz - SEO Software for Smarter Marketing'}, {'deleted_pages_to_page': 249094, 'deleted_pages_to_root_domain': 224212706, 'deleted_pages_to_subdomain': 898844, 'deleted_root_domains_to_page': 3696, 'deleted_root_domains_to_root_domain': 177001, 'deleted_root_domains_to_subdomain': 9251, 'domain_authority': 95, 'external_indirect_pages_to_root_domain': 156562794, 'external_nofollow_pages_to_page': 163849, 'external_nofollow_pages_to_root_domain': 72093550, 'external_nofollow_pages_to_subdomain': 294697, 'external_pages_to_page': 1165187, 'external_pages_to_root_domain': 514661963, 'external_pages_to_subdomain': 2310818, 'external_redirect_pages_to_page': 3049, 'external_redirect_pages_to_root_domain': 4827448, 'external_redirect_pages_to_subdomain': 8140, 'http_code': 301, 'indirect_root_domains_to_page': 1439, 'indirect_root_domains_to_root_domain': 30315, 'last_crawled': '2023-03-31', 'link_propensity': 0.02704063244, 'nofollow_pages_from_page': 0, 'nofollow_pages_from_root_domain': 97163, 'nofollow_pages_to_page': 163881, 'nofollow_pages_to_root_domain': 72644206, 'nofollow_pages_to_subdomain': 294765, 'nofollow_root_domains_from_page': 0, 'nofollow_root_domains_from_root_domain': 22711, 'nofollow_root_domains_to_page': 5647, 'nofollow_root_domains_to_root_domain': 178651, 'nofollow_root_domains_to_subdomain': 11590, 'page': 'nytimes.com/', 'page_authority': 82, 'pages_crawled_from_root_domain': 13567138, 'pages_from_page': 0, 'pages_from_root_domain': 3152122, 'pages_to_page': 1170498, 'pages_to_root_domain': 763781494, 'pages_to_subdomain': 2489707, 'redirect_pages_to_page': 3053, 'redirect_pages_to_root_domain': 9268395, 'redirect_pages_to_subdomain': 14273, 'root_domain': 'nytimes.com', 'root_domains_from_page': 0, 'root_domains_from_root_domain': 366864, 'root_domains_to_page': 25307, 'root_domains_to_root_domain': 2200598, 'root_domains_to_subdomain': 62699, 'spam_score': 1, 'subdomain': 'nytimes.com', 'title': ''}] - Moz'}]} 11. URL Metrics (url_metrics) 使用此端點獲取有關一個或多個 url 的指標。 {'results': } 12. Usage Data (usage_data) 該端點返回到目前為止消耗的行數在當前計費周期。 返回的計數可能不會反映上一小時消耗的行數。 返回的計數反映了對 v1(Moz 鏈接 API)和 v2 鏈接 API 的請求消耗的行數。 {'rows_consumed': 254}

關於邁克萊文 -

Mike 是 Moz 的高級 SEO 專家。

Facebook Comments Box

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。