Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python youtube dl提取的视频描述不包含换行符,被截断_Python_Youtube_Youtube Api_Youtube Dl - Fatal编程技术网

Python youtube dl提取的视频描述不包含换行符,被截断

Python youtube dl提取的视频描述不包含换行符,被截断,python,youtube,youtube-api,youtube-dl,Python,Youtube,Youtube Api,Youtube Dl,我有一个脚本,可以将视频信息的播放列表下载为json文件 昨天我得到了带有\n换行符的视频描述,但今天这些换行符现在只是一个空格,提取的描述被截断。我记得我的代码没有更改,youtube dl也没有更新 youtube改变了什么吗?还是我在什么地方出错了 Python 3.8.1,youtube dl 2020.6.16.1 下面是当前提取视频描述的代码,没有换行符 导入youtube\u dl 导入json ydl_选项={ “忽略错误”:True, } URL=['http://youtu.

我有一个脚本,可以将视频信息的播放列表下载为json文件

昨天我得到了带有
\n
换行符的视频描述,但今天这些换行符现在只是一个空格,提取的描述被截断。我记得我的代码没有更改,youtube dl也没有更新

youtube改变了什么吗?还是我在什么地方出错了

Python 3.8.1,youtube dl 2020.6.16.1

下面是当前提取视频描述的代码,没有换行符

导入youtube\u dl
导入json
ydl_选项={
“忽略错误”:True,
}
URL=['http://youtu.be/wFWihZTktUw', 'http://youtu.be/QvuQH4_05LI']
使用youtube_dl.YoutubeDL(ydl_选项)作为ydl:
打印('正在提取播放列表信息…')
播放列表信息=[]
对于idx,枚举中的url(url):
视频信息=ydl.extract信息(url,下载=False)
如果不是视频信息:
持续
属性=['title','id','description']
对于k in列表(video_info.keys()):
如果k不在属性中:
del视频信息[k]
播放列表信息附加(视频信息)
打开(f'playlist_info.json,'w')作为fp:
json.dump(播放列表信息,fp)
带换行符的示例结果(昨天的结果):

没有换行符和截断描述的示例结果(今天的结果):

这是一个似乎从今天开始的过程。这很可能与Youtube方面的变化有关。

可能与:
[
    {
        "id": "wTJI_WuZSwE",
        "title": "The impossible chessboard puzzle",
        "description": "An information puzzle with an interesting twist\nSolution on Stand-up Maths: https://youtu.be/as7Gkm7Y7h4\nHome page: https://www.3blue1brown.com\nBrought to you by you: https://3b1b.co/chess-thanks\n\n------------------\n0:00 Introduction\n3:58 Visualizing the two-square case\n5:46 Visualizing the three-square case\n12:19 Proof that it's impossible\n16:22 Explicit painting of the hypercube\n------------------\n\nThese animations are largely made using manim, a scrappy open-source python library:  https://github.com/3b1b/manim\n\nIf you want to check it out, I feel compelled to warn you that it's not the most well-documented tool, and it has many other quirks you might expect in a library someone wrote with only their own use in mind.\n\nMusic by Vincent Rubinetti.\nDownload the music on Bandcamp:\nhttps://vincerubinetti.bandcamp.com/album/the-music-of-3blue1brown\n\nStream the music on Spotify:\nhttps://open.spotify.com/album/1dVyjwS8FBqXhRunaG5W5u\n\nIf you want to contribute translated subtitles or to help review those that have already been made by others and need approval, you can click the gear icon in the video and go to subtitles/cc, then \"add subtitles/cc\".  I really appreciate those who do this, as it helps make the lessons accessible to more people.\n\n------------------\n\n3blue1brown is a channel about animating math, in all senses of the word animate.  And you know the drill with YouTube, if you want to stay posted on new videos, subscribe: http://3b1b.co/subscribe\n\nVarious social media stuffs:\nWebsite: https://www.3blue1brown.com\nTwitter: https://twitter.com/3blue1brown\nReddit: https://www.reddit.com/r/3blue1brown\nInstagram: https://www.instagram.com/3blue1brown_animations/\nPatreon: https://patreon.com/3blue1brown\nFacebook: https://www.facebook.com/3blue1brown"
    },
    {
        "id": "QvuQH4_05LI",
        "title": "Tips to be a better problem solver [Last lecture] | Lockdown math ep. 10",
        "description": "Tips on problem-solving, with examples from geometry, trig, and probability.\nPast episodes with integrated quizzes: https://itempool.com/c/3b1b\nFull playlist: https://www.youtube.com/playlist?list=PLZHQObOWTQDP5CVelJJ1bNDouqrAhVPev\nHome page: https://www.3blue1brown.com\nBrought to you by you: https://3b1b.co/ldm-thanks\nHuge huge thanks to Ben Eater: https://www.youtube.com/user/eaterbc\nAnd Cam Christensen, creator of ItemPool: https://itempool.com/\n\nNotes by Ngân Vũ:\nhttps://twitter.com/ThuyNganVu/status/1265480770832855040\n\nMistakes:\n50:35, there should be a dx in the integral\n54:40, if you notice the mistake here and are inclined to complain, keep watching\n\n\n------------------\nVideo timeline (thanks to user \"noonesperfect\")\n0:34  9-Problem Solving Principles/Tip\n1:15  Question 1 (Probability)\n2:08  Who is Ben Eater?\n4:25  Inscribed angle theorem, θL=2*θs\n5:58  Tip-1\n7:48  Tip-2\n8:16  Question 2\n9:34  Answer 2\n10:29 Tip-3\n15:17 Tip-4\n22:48 Question 3\n25:56 Answer 3 (Marked incorrectly, Answer: Option D)\n26:31 Answer 1\n27:28 Explanation for Q1, Floor function\n30:38 Tip-5\n32:53 Tip-6\n33:36 Question 4\n34:43 Answer 4\n36:37 Question 5\n38:10 Answer 5\n41:48 Probability graph in Desmos\n44:08 Revisiting an alternating series sum for ln(2)\n47:29 Tip-7\n51:08 Tip-8\n55:23 Audience questions through tweets\n57:28 Tip-9\n58:29 Python programming for various probability question\n1:04:31 Arts created using Desmos graph tool with mathematical expressions\n1:05:54 Thank you, appreciation to the team and all.\n------------------\nThe live question setup with stats on-screen is powered by Itempool.\nhttps://itempool.com/\n\nCurious about other animations?\nhttps://www.3blue1brown.com/faq#manim\n\nMusic by Vincent Rubinetti.\nDownload the music on Bandcamp:\nhttps://vincerubinetti.bandcamp.com/album/the-music-of-3blue1brown\n\nStream the music on Spotify:\nhttps://open.spotify.com/album/1dVyjwS8FBqXhRunaG5W5u\n\nIf you want to contribute translated subtitles or to help review those that have already been made by others and need approval, you can click the gear icon in the video and go to subtitles/cc, then \"add subtitles/cc\".  I really appreciate those who do this, as it helps make the lessons accessible to more people.\n\n------------------\n\n3blue1brown is a channel about animating math, in all senses of the word animate.  And you know the drill with YouTube, if you want to stay posted on new videos, subscribe: http://3b1b.co/subscribe\n\nVarious social media stuffs:\nWebsite: https://www.3blue1brown.com\nTwitter: https://twitter.com/3blue1brown\nReddit: https://www.reddit.com/r/3blue1brown\nInstagram: https://www.instagram.com/3blue1brown_animations/\nPatreon: https://patreon.com/3blue1brown\nFacebook: https://www.facebook.com/3blue1brown"
    }
[
    {
        "id": "wTJI_WuZSwE",
        "title": "The impossible chessboard puzzle",
        "description": "An information puzzle with an interesting twist Solution on Stand-up Maths: https://youtu.be/as7Gkm7Y7h4 Home page: https://www.3blue1brown.com Brought to yo..."
    },
    {
        "id": "QvuQH4_05LI",
        "title": "Tips to be a better problem solver [Last lecture] | Lockdown math ep. 10",
        "description": "Tips on problem-solving, with examples from geometry, trig, and probability. Past episodes with integrated quizzes: https://itempool.com/c/3b1b Full playlist..."
    }
]