【问题标题】:Age Restricitons on Youtube_dl, get_info, ytsearch100:Youtube_dl、get_info、ytsearch 100 的年龄限制:
【发布时间】:2023-02-08 04:35:40
【问题描述】:

我正在使用 ytsearch 方法并在我的代码中实现了忽略错误、跳过下载和年龄限制,但我一直遇到问题:

警告:无法下载视频信息网页:HTTP 错误 410:消失 错误:登录以确认您的年龄 该视频可能不适合某些用户。

并且输出不会继续附加到结果变量

这是我的代码:

ydl_opts = {'ignoreerrors': True, 'skipdownload': True, 'age_limit': '15'}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
    result = ydl.extract_info( "ytsearch100:reddit --date 2021", download=False)
    
title = list(map(lambda d: d['title'], result['entries']))
ids = list(map(lambda d: d['id'], result['entries']))
date = list(map(lambda d: d['upload_date'], result['entries']))
channel = list(map(lambda d: d['uploader'], result['entries']))

yt_df = yt_df.append(pd.DataFrame({'title':title,'ids':ids,'channel':channel,'date':date}))

我的错误如下。发生错误时,结果字典中似乎有空白行。我也尝试使用我的用户名和密码,但也没有用。

TypeError                                 Traceback (most recent call last)
/var/folders/k9/wwjktzjs3lzg4xwn06htpryh0000gn/T/ipykernel_72457/1081526299.py in <module>
      6     result = ydl.extract_info( "ytsearch100:reddit --date 2021 -i -q", download=False)
      7 
----> 8 title = list(map(lambda d: d['title'], result['entries']))
      9 ids = list(map(lambda d: d['id'], result['entries']))
     10 date = list(map(lambda d: d['upload_date'], result['entries']))

/var/folders/k9/wwjktzjs3lzg4xwn06htpryh0000gn/T/ipykernel_72457/1081526299.py in <lambda>(d)
      6     result = ydl.extract_info( "ytsearch100:reddit --date 2021 -i -q", download=False)
      7 
----> 8 title = list(map(lambda d: d['title'], result['entries']))
      9 ids = list(map(lambda d: d['id'], result['entries']))
     10 date = list(map(lambda d: d['upload_date'], result['entries']))

TypeError: 'NoneType' object is not subscriptable

我尝试更改 ydl_opts,在子集化之前从 results['entries'] 制作数据帧。

【问题讨论】:

    标签: python nested-lists youtube-dl


    【解决方案1】:

    查看 ydl_opts 库“age_limit”需要一个 int 而不是字符串。而用15岁作为年龄肯定是不允许有年龄限制的视频的。

    【讨论】:

      猜你喜欢
      • 2022-11-10
      • 2018-02-20
      • 2012-03-21
      • 1970-01-01
      • 2013-03-23
      • 1970-01-01
      • 1970-01-01
      • 2021-01-13
      • 1970-01-01
      相关资源
      最近更新 更多