python - 如何从 DailyMotion Video Api 获得十多个结果?
问题描述
我正在使用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 的方法或解决方法,或者这是他们这边的错误吗?
解决方案
我试图重现您的问题,但在这两种情况下我都收到了所有信息:
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
}
]
}
使用浏览器是否有相同的结果?
推荐阅读
- python - SQL:SELECT,其中许多列之一包含“x”并且结果不是“NULL”
- javascript - Safari顶部,左侧过渡问题
- sql - 哪个更快:2条插入语句,每条175K记录或1条语句在PostgreSQL中插入350K记录
- arrays - 两个数组,一个有时间,另一个有时间
- angular - 具有可观察添加选择值的 Angular ngFor
- jenkins - Openshift/Jenkins I want to change the version of the Jenkins which is in the persistent template in the browse catalog
- html - 即使从控制器更新后,Textarea ng-model 也会保留最后一个值
- android - 如果 RN 已被杀死,如何执行某些事件?
- django - How can I pass in a parameter to my TestCase in Django?
- ios - 将视频分享到 Instagram Story