我正在使用python进行API调用,它成功进行了调用,但是当我将views_totlal添加到字段中时,无论我为限制或分页添加了多少,它都将拉取限制为5。如果我没有该字段,我将获取所请求的全部金额或默认(10或100)条目。频道中有超过5个具有观看次数的视频。这是我的代码:
r = d.get('/user/xxxxxxx/videos?sort=visited&fields=thumbnail_480_url,views_total,id,title,likes_total')
有什么想法可以通过python使用API或提供解决方法,或者这是他们的错误吗?
答案 0 :(得分:0)
我试图重现您的问题,但在两种情况下我都收到了所有信息:
r = d.get('/user/DailymotionUSA/videos?sort=visited&fields=thumbnail_480_url,views_total,id,title,likes_total&limit=15')
print(json.dumps(r))
r = d.get('/user/DailymotionUSA/videos?sort=visited&fields=thumbnail_480_url,id,title,likes_total&limit=15')
print(json.dumps(r))
结果:
{
"page": 1,
"limit": 15,
"explicit": false,
"total": 117,
"has_more": true,
"list": [
{
"thumbnail_480_url": "https://s1-ssl.dmcdn.net/v/1olai1SufJKvfCijF/x480",
"views_total": 4701340,
"id": "xhwpbg",
"title": "BridgeStone 15 Sec spot",
"likes_total": 7
},
{
"thumbnail_480_url": "https://s2-ssl.dmcdn.net/v/3L7IG1SunL7OVPKGd/x480",
"views_total": 461409,
"id": "xx9evk",
"title": "The History Channel - Vikings Super Bowl Spot",
"likes_total": 3
},
{
"thumbnail_480_url": "https://s2-ssl.dmcdn.net/v/1soi51SgrWeOIf4Gt/x480",
"views_total": 356211,
"id": "xijg91",
"title": "SoapBoxRace_15_US_DM_Prestitial",
"likes_total": 0
},
{
"thumbnail_480_url": "https://s2-ssl.dmcdn.net/v/3NTtN1Siv7i6Umqxo/x480",
"views_total": 203238,
"id": "xxmms7",
"title": "2013 The Oscars Red Carpet Live Stream",
"likes_total": 7
},
{
"thumbnail_480_url": "https://s2-ssl.dmcdn.net/v/3LCi11Svd6s4ouVfn/x480",
"views_total": 167418,
"id": "xx9vy9",
"title": "2013 Grammy Awards Red Carpet Live Stream",
"likes_total": 3
},
{
"thumbnail_480_url": "https://s2-ssl.dmcdn.net/v/2Vo6O1Sgrf6Ne7Cd5/x480",
"views_total": 147042,
"id": "xoxriw",
"title": "Jennifer Aniston and J.Theroux milk a goat",
"likes_total": 8
},
{
"thumbnail_480_url": "https://s1-ssl.dmcdn.net/v/2j7zp1SguhjP4ABEH/x480",
"views_total": 98450,
"id": "xr0q5v",
"title": "Playboy Producer For a Day Teaser 1",
"likes_total": 16
},
{
"thumbnail_480_url": "https://s1-ssl.dmcdn.net/v/3KFRX1SgrW0V1qf5H/x480",
"views_total": 79681,
"id": "xx4ich",
"title": "Official Trailer: Dead Man Down",
"likes_total": 1
},
{
"thumbnail_480_url": "https://s2-ssl.dmcdn.net/v/2XrFk1SvzVBqsuLes/x480",
"views_total": 67974,
"id": "xp9a0e",
"title": "Assassin's Creed 3 - Official Debut Trailer",
"likes_total": 13
},
{
"thumbnail_480_url": "https://s2-ssl.dmcdn.net/v/26NKY1SguDkqgJf97/x480",
"views_total": 62389,
"id": "xkyy3m",
"title": "Kid Cudi - Mr Rager",
"likes_total": 59
},
{
"thumbnail_480_url": "https://s2-ssl.dmcdn.net/v/2KlDI1S-DXKExQl33/x480",
"views_total": 60743,
"id": "xn7pea",
"title": "Music - The Best! Brightest! Boldest! of 2011",
"likes_total": 3
},
{
"thumbnail_480_url": "https://s2-ssl.dmcdn.net/v/2EdMX1S-DXKl-e2ul/x480",
"views_total": 54550,
"id": "xm9axt",
"title": "Snow White and the Huntsman - Trailer",
"likes_total": 24
},
{
"thumbnail_480_url": "https://s1-ssl.dmcdn.net/v/1-rMo1S-Cda2MTSbT/x480",
"views_total": 51503,
"id": "xjsmuq",
"title": "Verizon - Rescue",
"likes_total": 0
},
{
"thumbnail_480_url": "https://s1-ssl.dmcdn.net/v/41vQ91SguvEhgPKv6/x480",
"views_total": 37585,
"id": "x14918p",
"title": "Palo Alto Official Movie Trailer",
"likes_total": 0
},
{
"thumbnail_480_url": "https://s2-ssl.dmcdn.net/v/2lSaj1SrP0z2doZnw/x480",
"views_total": 36707,
"id": "xrdru5",
"title": "Dailymotion & PlayboyTV Present: Zombie Killers",
"likes_total": 20
}
]
}
{
"page": 1,
"limit": 15,
"explicit": false,
"total": 117,
"has_more": true,
"list": [
{
"thumbnail_480_url": "https://s2-ssl.dmcdn.net/v/1olai1SufJKvfCijF/x480",
"id": "xhwpbg",
"title": "BridgeStone 15 Sec spot",
"likes_total": 7
},
{
"thumbnail_480_url": "https://s2-ssl.dmcdn.net/v/3L7IG1SunL7OVPKGd/x480",
"id": "xx9evk",
"title": "The History Channel - Vikings Super Bowl Spot",
"likes_total": 3
},
{
"thumbnail_480_url": "https://s2-ssl.dmcdn.net/v/1soi51SgrWeOIf4Gt/x480",
"id": "xijg91",
"title": "SoapBoxRace_15_US_DM_Prestitial",
"likes_total": 0
},
{
"thumbnail_480_url": "https://s1-ssl.dmcdn.net/v/3NTtN1Siv7i6Umqxo/x480",
"id": "xxmms7",
"title": "2013 The Oscars Red Carpet Live Stream",
"likes_total": 7
},
{
"thumbnail_480_url": "https://s2-ssl.dmcdn.net/v/3LCi11Svd6s4ouVfn/x480",
"id": "xx9vy9",
"title": "2013 Grammy Awards Red Carpet Live Stream",
"likes_total": 3
},
{
"thumbnail_480_url": "https://s2-ssl.dmcdn.net/v/2Vo6O1Sgrf6Ne7Cd5/x480",
"id": "xoxriw",
"title": "Jennifer Aniston and J.Theroux milk a goat",
"likes_total": 8
},
{
"thumbnail_480_url": "https://s1-ssl.dmcdn.net/v/2j7zp1SguhjP4ABEH/x480",
"id": "xr0q5v",
"title": "Playboy Producer For a Day Teaser 1",
"likes_total": 16
},
{
"thumbnail_480_url": "https://s2-ssl.dmcdn.net/v/3KFRX1SgrW0V1qf5H/x480",
"id": "xx4ich",
"title": "Official Trailer: Dead Man Down",
"likes_total": 1
},
{
"thumbnail_480_url": "https://s2-ssl.dmcdn.net/v/2XrFk1SvzVBqsuLes/x480",
"id": "xp9a0e",
"title": "Assassin's Creed 3 - Official Debut Trailer",
"likes_total": 13
},
{
"thumbnail_480_url": "https://s1-ssl.dmcdn.net/v/26NKY1SguDkqgJf97/x480",
"id": "xkyy3m",
"title": "Kid Cudi - Mr Rager",
"likes_total": 59
},
{
"thumbnail_480_url": "https://s1-ssl.dmcdn.net/v/2KlDI1S-DXKExQl33/x480",
"id": "xn7pea",
"title": "Music - The Best! Brightest! Boldest! of 2011",
"likes_total": 3
},
{
"thumbnail_480_url": "https://s1-ssl.dmcdn.net/v/2EdMX1S-DXKl-e2ul/x480",
"id": "xm9axt",
"title": "Snow White and the Huntsman - Trailer",
"likes_total": 24
},
{
"thumbnail_480_url": "https://s2-ssl.dmcdn.net/v/1-rMo1S-Cda2MTSbT/x480",
"id": "xjsmuq",
"title": "Verizon - Rescue",
"likes_total": 0
},
{
"thumbnail_480_url": "https://s1-ssl.dmcdn.net/v/41vQ91SguvEhgPKv6/x480",
"id": "x14918p",
"title": "Palo Alto Official Movie Trailer",
"likes_total": 0
},
{
"thumbnail_480_url": "https://s2-ssl.dmcdn.net/v/2lSaj1SrP0z2doZnw/x480",
"id": "xrdru5",
"title": "Dailymotion & PlayboyTV Present: Zombie Killers",
"likes_total": 20
}
]
}
使用浏览器获得相同的结果吗?