2013-02-05 107 views
0

我想製作一個簡單的腳本,使用它的v3 API搜索YouTube,但對於特定的關鍵字,我沒有獲得與youtube.com相同的視頻。Youtube搜索API準確性

這是URL我使用:https://www.googleapis.com/youtube/v3/search?order=relevance&regionCode=US&type=video&part=snippet&maxResults=10&q=test&key=*****

任何想法如何準確的是API與youtube.com相比?

回答

0

API應該與網站的準確性相同。你使用相同的用戶帳戶進行測試嗎?你能給一些具體的例子來跟進嗎?

+1

你的答案可能是正確的,但理想情況下,你應該用源對其進行備份並儘可能地鏈接。以上內容很容易被理解爲一個人的意見。 – ryadavilli

0

我使用我的代碼測試了其他地區的搜索過濾器,因爲我在阿根廷,並且試圖只獲得3個視頻。

我與API和YouTube頁面的結果相同。

GET https://www.googleapis.com/youtube/v3/search?part=snippet&maxResults=3&order=relevance&q=test&regionCode=AR&type=video&key={YOUR_API_KEY} 

我得到這樣的迴應:

200 OK 

- Show headers - 

{ 
"kind": "youtube#searchListResponse", 
"etag": "\"GGhQgtOz7wdV-KaTX3akpjqktXI/ZQcMULMzhl7jNZmXCsem5ycElvI\"", 
"pageInfo": { 
    "totalResults": 1000000, 
    "resultsPerPage": 3 
}, 
"nextPageToken": "CAMQAA", 
"items": [ 
    { 
    "id": { 
    "kind": "youtube#video", 
    "videoId": "nCgQDjiotG0" 
    }, 
    "kind": "youtube#searchResult", 
    "etag": "\"GGhQgtOz7wdV-KaTX3akpjqktXI/4xgmXYRPkRjv8kxP_M5CKZQM2GM\"", 
    "snippet": { 
    "publishedAt": "2010-05-04T00:49:30.000Z", 
    "channelId": "UCL8ZULXASCc1I_oaOT0NaOQ", 
    "title": "Google Chrome Speed Tests", 
    "description": "These speed tests were filmed at actual web page rendering times. If you're interested in the technical details, read on! Equipment used ...", 
    "thumbnails": { 
    "default": { 
     "url": "https://i.ytimg.com/vi/nCgQDjiotG0/default.jpg" 
    }, 
    "medium": { 
     "url": "https://i.ytimg.com/vi/nCgQDjiotG0/mqdefault.jpg" 
    }, 
    "high": { 
     "url": "https://i.ytimg.com/vi/nCgQDjiotG0/hqdefault.jpg" 
    } 
    } 
    } 
    }, 
    { 
    "id": { 
    "kind": "youtube#video", 
    "videoId": "N7-T53_pOSM" 
    }, 
    "kind": "youtube#searchResult", 
    "etag": "\"GGhQgtOz7wdV-KaTX3akpjqktXI/T1_ucgK_momRYuuh8o4LvRpJHWM\"", 
    "snippet": { 
    "publishedAt": "2012-10-03T21:40:01.000Z", 
    "channelId": "UCOmcA3f_RrH6b9NmcNa4tdg", 
    "title": "Always On - Torture testing the iPhone 5 Ep 16", 
    "description": "cnet.com The iPhone 5 enters the torture chamber, the Tesla S gets unboxed, the Galaxy S3 is thrown in the washing machine, and Molly Wood sets ...", 
    "thumbnails": { 
    "default": { 
     "url": "https://i.ytimg.com/vi/N7-T53_pOSM/default.jpg" 
    }, 
    "medium": { 
     "url": "https://i.ytimg.com/vi/N7-T53_pOSM/mqdefault.jpg" 
    }, 
    "high": { 
     "url": "https://i.ytimg.com/vi/N7-T53_pOSM/hqdefault.jpg" 
    } 
    } 
    } 
    }, 
    { 
    "id": { 
    "kind": "youtube#video", 
    "videoId": "ubNF9QNEQLA" 
    }, 
    "kind": "youtube#searchResult", 
    "etag": "\"GGhQgtOz7wdV-KaTX3akpjqktXI/NM08y0TtHGe2IYmzq8XNDhy6WhY\"", 
    "snippet": { 
    "publishedAt": "2008-11-03T17:49:54.000Z", 
    "channelId": "UCFsK_jxE6BghGx4d2QJLJzQ", 
    "title": "Test Your Awareness : Whodunnit?", 
    "description": "Test your Awareness with Do The Test's Whodunnit. Who Killed Lord Smithe? TFL cycling safety advert! How observant are you? How did you do? www ...", 
    "thumbnails": { 
    "default": { 
     "url": "https://i.ytimg.com/vi/ubNF9QNEQLA/default.jpg" 
    }, 
    "medium": { 
     "url": "https://i.ytimg.com/vi/ubNF9QNEQLA/mqdefault.jpg" 
    }, 
    "high": { 
     "url": "https://i.ytimg.com/vi/ubNF9QNEQLA/hqdefault.jpg" 
    } 
    } 
    } 
    } 
] 
} 

而在YouTube頁面,我得到了相同的結果:

Google Chrome Speed Tests 
by Google Chrome•2 years ago•6,721,020 views 
These speed tests were filmed at actual web page rendering times. If you're interested in the technical details, read on ... 
HDCC 
31:01 
Always On - Torture testing the iPhone 5 Ep 16 
by CNETTV•4 months ago•267,084 views 
Season 2•Episode 16•Always On 
cnet.com The iPhone 5 enters the torture chamber, the Tesla S gets unboxed, the Galaxy S3 is thrown in the washing machine ... 
HD 
1:55 
Test Your Awareness : Whodunnit? 
by dothetest•4 years ago•3,477,032 views 
Test your Awareness with Do The Test's Whodunnit. Who Killed Lord Smithe? TFL cycling safety advert! How observant are you ... 
HD 
+0

但是,當我嘗試檢索10個視頻時,我在API頁面和YouTube頁面中獲得了相同的列表,但順序不同。 –