2013-02-05 106 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页面中获得了相同的列表,但顺序不同。 –