【问题标题】:Unable to download list of all Videos on Dailymotion无法下载 Dailymotion 上所有视频的列表
【发布时间】:2019-11-29 22:00:12
【问题描述】:

我正在使用 Dailymotion API 来获取我频道上所有视频的列表。虽然我的频道有 3000 多个视频,但我只能扫描和下载 1000 个视频的列表。请帮忙。

频道链接:https://www.dailymotion.com/prashant_advait

下面是代码:

import dailymotion

d = dailymotion.Dailymotion()

d.set_grant_type(
            "password",
            api_key=_API_KEY_HINDI,
            api_secret=_API_SECRET_HINDI,
            scope=["manage_videos"],
            info={"username": _USERNAME_HINDI, "password": _PASSWORD_HINDI},
        )


page = 1

while(True):
    api_call = '/me/videos?fields=id,title,url,tags&limit=100&page=' + str(page)
    r = d.get(api_call)

    print(r)

    if r['has_more'] is False:
        break

    page = r['page']+1

在第 10 页,GET 请求将“has_more”字段设置为 False,并且没有更多视频。

以下调用没有结果:

api_call = '/me/videos?fields=id,title,url&limit=100&page=' + str(11)
r = d.get(api_call)

结果:

{'page': 11, “限制”:100, “显式”:错误, “总计”:0, 'has_more':错误, “列表”:[]}

【问题讨论】:

    标签: python dailymotion-api


    【解决方案1】:

    您可以使用created_aftersort=old 等参数来减少API 返回的视频集。到达最后一页的最后一个视频后,使用 created_time 字段值从该日期开始执行新的 API 调用。

    例子:

    1. https://api.dailymotion.com/me/videos?fields=id,title,url,created_time&limit=100&page=10&sort=old
    2. https://api.dailymotion.com/me/videos?fields=id,title,url,created_time&limit=100&page=1&sort=old&created_after=123456789

    如果这还不足以浏览您的所有目录,请联系您的 Dailymotion 联系人以寻求解决方案。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-10-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-12-16
      相关资源
      最近更新 更多