爬取学习强国视频小示例

时间:2024-04-06 13:46:50
  • 因为需要爬取的视频数量并不是很大,总共需要将131个视频下载下来,所以就直接去手动找找视频的地址和名称保存下来的。
  • 由于页面是动态加载的,所以我们无法在网站源码中直接找到视频的超链接。设想是可以用Selenium模拟浏览器点击进行动态加载获取视频链接和标题的,不过很久没有用Selenium了,就图简单偷点懒啦。
  • 所以以下代码就是用requests去直接请求mp4地址得到批量下载的结果的。
    在这里插入图片描述
    参考:https://zhuanlan.zhihu.com/p/132703833
# https://article.xuexi.cn/articles/video/index.html?art_id=294702920556063797
import requests
import os


def download_mp4_by_url(url, name, n):
    """
    通过链接下载视频链接下载相应的mp4视频。
    :param url: mp4视频超链接。
    :param name: 视频保存的主题名
    :param n: 视频的顺序编号
    :return:
    """
    headers = {
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36 Edg/123.0.0.0"
    }
    video_data = requests.get(url, headers=headers).content
    if not os.path.exists("./视频"):
        os.mkdir("./视频")
    with open(f"./视频/{n}.{name}.mp4", "wb") as f:
        f.write(video_data)
        print(f"正在下载第{n}个视频:{name}")


def main():
    urlstr = """https://boot-video.xuexi.cn/video/1006/p/5fd0919e562a1eedd1a8f740849f491a-72ee9dcf0fa440d7b8974dbea2538d39-2.mp4,https://boot-video.xuexi.cn/video/1006/p/29057017b697b69ba089b141ffa7155b-72dba5794ada485fa36916ca6c4bb276-2.mp4,https://boot-video.xuexi.cn/video/1006/p/7556c7043e88186b0bfb60a1abe27481-610517fe75974eef92edaf44fd579853-2.mp4,https://boot-video.xuexi.cn/video/1006/p/6cf3b6826f95653511f5dd8ea42b95c9-ff6425a5b1db4fc9b406c42480ebaae4-2.mp4,https://boot-video.xuexi.cn/video/1006/p/dca2b2122efa84ef43c0cf3c05b728d4-60f0576258944bea936d0aea6d9e9e50-2.mp4,https://boot-video.xuexi.cn/video/1006/p/e7c7db360b47191742ef7266aa509573-11044cf3d6d643619924122f2374bf2b-2.mp4,https://boot-video.xuexi.cn/video/1006/p/ae79b9d0c3391a1380a866a9ce2c781a-e5b2e7be528e4d59802175f2d74af5a9-2.mp4,https://boot-video.xuexi.cn/video/1006/p/d3e06265dadc66fd354649793d8aa75e-da7788f2a0984b87b67ff1d6f3e6d6a7-2.mp4,https://boot-video.xuexi.cn/video/1006/p/5613cceb7b31f3eefb8d3c1d1279be47-b9f0d1d881474f16a057c049056daa3b-2.mp4,https://boot-video.xuexi.cn/video/1006/p/0a3767c3924b2d0dc29b8e9c802a81da-46e9198132224d58a79abaf184b39c39-2.mp4,https://boot-video.xuexi.cn/video/1006/p/f5337dcf1029d1755d15b39e1bb34733-2a696096f6614b1780858c64ce8a29c5-2.mp4,https://boot-video.xuexi.cn/video/1006/p/fa1beb92f52913d5d0502e3fa5f096d5-1e0f65c5f8c8406eb34b6210670033c9-2.mp4,https://boot-video.xuexi.cn/video/1006/p/38566457defcadd3b6d9132a38d6ab29-0b349aaffb9c496287f4e1ef64876e86-2.mp4,https://boot-video.xuexi.cn/video/1006/p/5f8b2eb6b9dea34354d05d67f1882ada-b8ec6f074f064290a1182c6ccdae7eba-2.mp4,https://boot-video.xuexi.cn/video/1006/p/731132a6d4d87f7b9e0b9a94a65a5a06-dcf3f148b0c04724b320c7956caedf86-2.mp4,https://boot-video.xuexi.cn/video/1006/p/03a8ba3d09d1c4753546f5b3550a9251-8cec7ba4c26f4bc2bc7a6540cfb0fc7b-2.mp4,https://boot-video.xuexi.cn/video/1006/p/77cdb7969c3fef76cb1615f3c0718a46-5b6cccd988bb40a9a4fdc271061a336f-2.mp4,https://boot-video.xuexi.cn/video/1006/p/527970e4c8030524654803d3d159dbc8-6286fef291be46d5af41900f6988d1d4-2.mp4,https://boot-video.xuexi.cn/video/1006/p/1d6d6e6abd84ceb6368f039aa086a01c-a37df97a4cdf4212ab1982ce7dae1ab7-2.mp4,https://boot-video.xuexi.cn/video/1006/p/af756c8900e9c9b6b54412abb39be9ab-e37dd2b6537846b3a916e35d5dd99b52-2.mp4,https://boot-video.xuexi.cn/video/1006/p/271c0ec735a04cc00b9d13986d7cd65b-83c9c880f0bb4f07a103693f34aa9a95-2.mp4,https://boot-video.xuexi.cn/video/1006/p/29beed2e15abfbe3ba457a6a8d1d1c9c-660da4a738354dd09325aecfab268a43-2.mp4,https://boot-video.xuexi.cn/video/1006/p/a421df188b71340d3d0fee3a1e19fe14-d12daf58c6b24a14b46e6c7e5dc191ea-2.mp4,https://boot-video.xuexi.cn/video/1006/p/2771da94f2ce433a17ff61f8b870bb56-7fe1239fec054348ab1a281616bc146c-2.mp4,https://boot-video.xuexi.cn/video/1006/p/0fde550a85cca3c08a8c1356e21b760b-6be5b3e2d1a34fbd84f69dc955ace72d-2.mp4,https://boot-video.xuexi.cn/video/1006/p/418eb399a3e67bce6ef6748e848107a2-24b9382f5fa94b23ba09477508ba574f-2.mp4,https://boot-video.xuexi.cn/video/1006/p/f82578fa00d98c2d5369661b4a833d70-ef9baf0d218f4bebb25d7ed57db15451-2.mp4,https://boot-video.xuexi.cn/video/1006/p/42466a20053129df040b6dc39af56318-376df6c52bd940229b22aeab66273800-2.mp4,https://boot-video.xuexi.cn/video/1006/p/a153916e82b6c2b0c839dffbba49dec8-721d3890f73c404996508806848fd353-2.mp4,https://boot-video.xuexi.cn/video/1006/p/6d992bc4a29759ca59c0271ef82c95a8-8c120ce367e34ef799868ba1d0446180-2.mp4,https://boot-video.xuexi.cn/video/1006/p/a1a44024fd503a83381f7d8d617f7a5b-79d8b33098b4415db91cfd1ccfdad1f0-2.mp4,https://boot-video.xuexi.cn/video/1006/p/bc811f4dca003b28fd650b1d49c5ba0e-6e443a4230014feb954822a7d68e0c85-2.mp4,https://boot-video.xuexi.cn/video/1006/p/af274d40ddaa2f92d813d5cb6929e4ce-0f11ba22431c49b18701bbc69c300058-2.mp4,https://boot-video.xuexi.cn/video/1006/p/41ff8cabc43fb9bc03ce7fcc0b00eab3-eddc63b4e0e54c2bbede9ed5f02f73be-2.mp4,https://boot-video.xuexi.cn/video/1006/p/8fa92f5e955de50dad8f5e6cd6d9f7ef-30147986d805487f897295f5f13cd13b-2.mp4,https://boot-video.xuexi.cn/video/1006/p/e643da5bde09e6cd536b19ba755063cc-c54a968d54b7401484d85c2c78920e8f-2.mp4,https://boot-video.xuexi.cn/video/1006/p/0a2edf04db75c690a612e5447ee5a070-f907ddf5c87e4456b1a9dc84d79ea3dd-2.mp4,https://boot-video.xuexi.cn/video/1006/p/5e0d7314991de52da8d5b1567813512d-3398307fc32f42cc977f8133f803b76f-2.mp4,https://boot-video.xuexi.cn/video/1006/p/89dd21b2a52faa3c0b75ac1fca03b7cf-745f01a55bc544c4a62464b6e99903d8-2.mp4,https://boot-video.xuexi.cn/video/1006/p/bb9d200a5ed90d19a34265d0f74fe6cf-e6bd05f32ba143e8a40d71d9667e740b-2.mp4,https://boot-video.xuexi.cn/video/1006/p/957e47de4370b3c73c065bd802c52c01-c9d90b11e50f43bf9de79fa56679784c-2.mp4,https://boot-video.xuexi.cn/video/1006/p/cfaf1576ba3b1df2fb8d1b4cfab5d26f-b2e0841da56940a7ad56340633fc6471-2.mp4,https://boot-video.xuexi.cn/video/1006/p/dba15bb80b59fbe6ab95f7360d67bc11-804eb20577ab4877bd7cda30d119ac3e-2.mp4,https://boot-video.xuexi.cn/video/1006/p/8f6d37ca8d45421b468617407df5c95f-37ee2e67fbec4a47844ec3e1ad6f6040-2.mp4,https://boot-video.xuexi.cn/video/1006/p/31176f17aeb61a6d32f960f4bd4a0686-8429f54b53f04a00b24c0bbe2817a686-2.mp4,https://boot-video.xuexi.cn/video/1006/p/5eddff452cad6fe4297e89057799e6bb-3a20a92776334dd08b7b12b5befeaf42-2.mp4,https://boot-video.xuexi.cn/video/1006/p/4aa35925803a1693b35f33736f90dd25-a29d01ca9e7440778fe1b40d78734415-2.mp4,https://boot-video.xuexi.cn/video/1006/p/d29e527934c0556141964732ff3220a1-0ec288d0ddbd44d09cd216678d791933-2.mp4,https://boot-video.xuexi.cn/video/1006/p/0b46fda6f873b0623dd981e157f7e014-acb282c7a3cd477fb72b062227815890-2.mp4,https://boot-video.xuexi.cn/video/1006/p/9f6164c2950b2d37e816fbd7c8c49347-716d290572d84d98ad301c07c17de5cb-2.mp4,https://boot-video.xuexi.cn/video/1006/p/986491bd130e85fddc048eb759cec2fd-56620b7bd08d4ee491db3aa5e7b283e2-2.mp4,https://boot-video.xuexi.cn/video/1006/p/56054bf540fa797e71e3f866c24a09ce-8e9cbf1476ef4dca9b6a7d3bdbfaaf90-2.mp4,https://boot-video.xuexi.cn/video/1006/p/2c7adba23f684e661a7a72766c8a9c17-d734f23b6cbb4ac58dc65ed0cfb42568-2.mp4,https://boot-video.xuexi.cn/video/1006/p/631cb0e564b1944c9ecd957c34a57e88-7c10d4b506d84a8eb03e65b18375ef38-2.mp4,https://boot-video.xuexi.cn/video/1006/p/43ea00ebb945581bf72cde9ca89f2da6-08b1848464374392841074537a34b02d-2.mp4,https://boot-video.xuexi.cn/video/1006/p/46bfe422e70f5d28e248f9ab0d121c38-3e07163b3488418d9ac47fc1798b6bf6-2.mp4,https://boot-video.xuexi.cn/video/1006/p/83f771f0bd7369059b77c3b56ccf7664-9fc2cb92c367485887ea27da8aca904e-2.mp4,https://boot-video.xuexi.cn/video/1006/p/2ee715f21f61106f83e4f901426f136c-1e928dd5f7894ec98cf01123cecd0cab-2.mp4,https://boot-video.xuexi.cn/video/1006/p/a21341b0f5365a32fb8ae2313ae4fc7f-70ec698a68504d74ac87ef4d85f2dec9-2.mp4,https://boot-video.xuexi.cn/video/1006/p/6d3df788e997368bf7163d0dea38acae-0a23ca135101497f931409eed598b5b1-2.mp4,https://boot-video.xuexi.cn/video/1006/p/83ff2a8a6450a5983469c043dfd2ab9b-a03cf7420bf14e809c3501c9cba48cc6-2.mp4,https://boot-video.xuexi.cn/video/1006/p/52c48538b7008cdd480567dea643fa1d-5067f428d79d4758adf6931011a243ec-2.mp4,https://boot-video.xuexi.cn/video/1006/p/6f79a0cd7731e53de00aef3f77b6ba75-1b9f9f0f3318445c8714db7177c75eed-2.mp4,https://boot-video.xuexi.cn/video/1006/p/502ca838457f46985e7d339c9dd94d84-7b79ac473f62441fbc6191ad1c0ed4ef-2.mp4,https://boot-video.xuexi.cn/video/1006/p/f2dfec5d09fd5c3d7b06d65be1afbf44-5124232c0efd41a2b28dd1a5fd991ff9-2.mp4,https://boot-video.xuexi.cn/video/1006/p/29a6bdcbda1d9360fa4c97add1b21258-a6b68866bc8748398a2ac6ff8f1340ad-2.mp4,https://boot-video.xuexi.cn/video/1006/p/1f57dd2a0cf5b7e97e63c6e884087a90-a0a325f1bb2849f5a467bb997bf21878-2.mp4,https://boot-video.xuexi.cn/video/1006/p/70f2c3fb09c7c798c18ea2e64e64252b-40629663598848f6a5ea55ae7fc95732-2.mp4,https://boot-video.xuexi.cn/video/1006/p/ce6daa2b530771a5f69b207e011e82cb-57309ee44bf944e48a79b9b09c84c758-2.mp4,https://boot-video.xuexi.cn/video/1006/p/4961b8cd99003f6f41382e4ebb89fcef-51bd8225f3b149239c18f6b300b48f0f-2.mp4,https://boot-video.xuexi.cn/video/1006/p/73f29350eb985704089b7b61a6eaf3e4-c7f4b173d8dd4195b61242f14ef15c46-2.mp4,https://boot-video.xuexi.cn/video/1006/p/a219b07be0bc35ff41ad5ebf068dc34f-e6736b582b2b4591aa4f100f8b94b7ab-2.mp4,https://boot-video.xuexi.cn/video/1006/p/410a9f2f0b6192bdbdaa39396221f52c-6852abed973d42349d4c9bedbc550f6b-2.mp4,https://boot-video.xuexi.cn/video/1006/p/2ab710a6ce7ddaf96aa1b28e0cf4f6c3-abcb2769e33347559f5e8d2b286b3dd3-2.mp4,https://boot-video.xuexi.cn/video/1006/p/15f6c34100bf876c7dcc0049592d683e-734f90bde3904afa98580647fdbe398b-2.mp4,https://boot-video.xuexi.cn/video/1006/p/71ce68defb78b286f976b4530a830a6f-98b9f922db814055b52f4a8f9281bafc-2.mp4,https://boot-video.xuexi.cn/video/1006/p/3a2c3bb124c84f6a917db9e048692f70-bbae575fb9ff4eafb32cc78fecd1177d-2.mp4,https://boot-video.xuexi.cn/video/1006/p/af73e42dffa0206148713cd5555eceb7-1c22d2375710400d8e7c3f4071e5e644-2.mp4,https://boot-video.xuexi.cn/video/1006/p/88e36e96e5a09720aae36b67ed7c18f6-767d5dc02b2f46c18c202726bdd3fcee-2.mp4,https://boot-video.xuexi.cn/video/1006/p/8529ebb9aa153b4d04325e8584b1cd44-8cc16ecb8ad2441ebedf9d3cef76ebb5-2.mp4,https://boot-video.xuexi.cn/video/1006/p/4cbcf0776115a5a2409743c6286a7518-19c79ec4844646e78a12066c9d60e56b-2.mp4,https://boot-video.xuexi.cn/video/1006/p/cff211b0944565f0957ce65053239889-f485890a475047eebf81676a914acf96-2.mp4,https://boot-video.xuexi.cn/video/1006/p/649a17f375e581227c785f07f008164b-ff245af5c0b34118b118783865876148-2.mp4,https://boot-video.xuexi.cn/video/1006/p/395bfdbbfa2a13c48b42dffe60a964bb-db31575eb79548f087c8529fe8c57516-2.mp4,https://boot-video.xuexi.cn/video/1006/p/8c52ce19002c1b856d0efdacc1038db8-bc33fa71867440b8a62c34b1f59b4cba-2.mp4,https://boot-video.xuexi.cn/video/1006/p/3d0bfb2473842a295440720e7542bbba-43027d30f1bb49849fadf3f3679f913c-2.mp4,https://boot-video.xuexi.cn/video/1006/p/519b8af4b34e66ae125d551241434a83-eefe47cb08f24a63bf909094014676dd-2.mp4,https://boot-video.xuexi.cn/video/1006/p/fec74636fee82ccf3f47c5a1b96ba3ca-2e0d6d812d994b8693f77c813034ca27-2.mp4,https://boot-video.xuexi.cn/video/1006/p/3ce509ee964328884c429c416316e6eb-6d2ee7402de84677869bd6f44e408e1a-2.mp4,https://boot-video.xuexi.cn/video/1006/p/bd622a6f00cae493ca1205a035c93bf3-7224ed9b66d14cd1bd472637fc454853-2.mp4,https://boot-video.xuexi.cn/video/1006/p/02797843a2932a33e05ab8fa2b554d42-389940076e71460398a864ea6c32570c-2.mp4,https://boot-video.xuexi.cn/video/1006/p/da464b41516e6f53e1958d2f5702f53d-f614569db0f14e0ca1599222c17fb327-2.mp4,https://boot-video.xuexi.cn/video/1006/p/3ec09182194483e86ec42aa9cf5599f2-bdba19cc1ad84deb847bc6f1b70534eb-2.mp4,https://boot-video.xuexi.cn/video/1006/p/7b26c133b0cfca42ecf2ccbbfc36e689-42b9ff237c884d4dbce2a2842c8faf53-2.mp4,https://boot-video.xuexi.cn/video/1006/p/ad2d5062484e74e05641810d06e71c25-879dfddb8e0049c19680ae7bdff7a403-2.mp4,https://boot-video.xuexi.cn/video/1006/p/1cc397e194d914206a193a0dcbaaf649-f91e7a62bbdf4c4eafd27555096644e2-2.mp4,https://boot-video.xuexi.cn/video/1006/p/b0360d98873df7e7854e30e20dabd107-6e2cdd39c434474cbe408bcc4eeb0594-2.mp4,https://boot-video.xuexi.cn/video/1006/p/d5b209f3d6f05c4adbecab5dd415d58a-45c825d86b0640b5a20b445dd9ee1dc2-2.mp4,https://boot-video.xuexi.cn/video/1006/p/98bef60af42e3d6471bf1df948271118-58f6145b62d044fa9b5fa6ab86b64903-2.mp4,https://boot-video.xuexi.cn/video/1006/p/eb44453847aa49b61a174aec80abfc24-c0eb3b0efe794496b46a7fc22c5b969d-2.mp4,https://boot-video.xuexi.cn/video/1006/p/229f90b1ebf77732b3e6b426b82b07c0-92a75187186342d98630cc271b4efe5f-2.mp4,https://boot-video.xuexi.cn/video/1006/p/2be1df82bd23510e11257533486ecd23-77cdbfbe7f104d04acb276c4f6587b78-2.mp4,https://boot-video.xuexi.cn/video/1006/p/c46ee3226a22101331473c2397149c6f-69e2474d16e94f399d21a1d443b7c4c8-2.mp4,https://boot-video.xuexi.cn/video/1006/p/135ff5aba7cd42529db9f43e06149cd0-f6260aafb4514ba3915288e7b8bb2c3d-2.mp4,https://boot-video.xuexi.cn/video/1006/p/e9e0d0dce252ead465243991dead1585-d946b3e7c002413fbcd3f949813a7be4-2.mp4,https://boot-video.xuexi.cn/video/1006/p/a5b6ed955d7769af321c29b33059e545-2ffef5615a69435dbc93b7385072514c-2.mp4,https://boot-video.xuexi.cn/video/1006/p/f71231f0ff95a31d883e7a459d7ac7a5-59d3a7417c3a4671b7e75da2646097a7-2.mp4,https://boot-video.xuexi.cn/video/1006/p/14b972a46469283fe35ab9dc1746ca2e-be534fd49c23443898886d25084a5b24-2.mp4,https://boot-video.xuexi.cn/video/1006/p/aa1c1d3b2055f8e4e8e4bd135e162c0f-76aa004b273f4755a0d7a81fed81cf14-2.mp4,https://boot-video.xuexi.cn/video/1006/p/96ad67bd488fbee5edc05d882e687e46-78719eefb76c4b3d98db80c312e6060f-2.mp4,https://boot-video.xuexi.cn/video/1006/p/23c5b6b4a2a68c2555f4bc742236ca9b-a8298be10a9c4fbaa81c2cea3072932d-2.mp4,https://boot-video.xuexi.cn/video/1006/p/a1675428e11e764fbd1768b7f574b232-b7a9f438df8344f5861864c75e0bc9dd-2.mp4,https://boot-video.xuexi.cn/video/1006/p/e978f876a8417a42b21fdc980aff8925-778554c730d44be98bfe99352328479b-2.mp4,https://boot-video.xuexi.cn/video/1006/p/aac5acc7939a9590043d86be9f069e2d-ee3d8dbccb074707a1abf50ee4ea1cae-2.mp4,https://boot-video.xuexi.cn/video/1006/p/6a8657cc800fcbdebdc8f65864c4ebe4-e581f011019948dc98f37039085fc1b6-2.mp4,https://boot-video.xuexi.cn/video/1006/p/131c9b7e970f2b1cb289ee1f23ad4d4c-fc11d379a8d74699bc14f31ec61d5d9f-2.mp4,https://boot-video.xuexi.cn/video/1006/p/e8aea8cf65437dd1a6a3ee4f64150926-9171928858d64378b75e5f44171e3806-2.mp4,https://boot-video.xuexi.cn/video/1006/p/cb2393a3288c22fb33c118b47962731a-0fcc03caa2a04a0bb28314d5a5c55bfd-2.mp4,https://boot-video.xuexi.cn/video/1006/p/8d90b321cdab66934de7988d79f42d11-a5b1bf245b5048f29de29b28f0cf4b29-2.mp4,https://boot-video.xuexi.cn/video/1006/p/f0f79d4991d24406c4b1000808866aed-efbe26a5306c45df972488689c0ac6ca-2.mp4,https://boot-video.xuexi.cn/video/1006/p/e0fb2e96085f1f5db5f7492c212654c2-904f1c1ae17d4128a7af950eb010124d-2.mp4,https://boot-video.xuexi.cn/video/1006/p/19923f0e72ca7b750bf112796a14cda9-e6d6acb0e08f4b84aaf8f31dfd4ba09a-2.mp4,https://boot-video.xuexi.cn/video/1006/p/3e72c126a54dc9c8093b4301a8639a94-3f4b29907d8543c58dd2046ad853e415-2.mp4,https://boot-video.xuexi.cn/video/1006/p/22a8b76f1af75caca3bfdd47ad5ba8af-1c745b99a01c4a0a86e6ee0365aad457-2.mp4,https://boot-video.xuexi.cn/video/1006/p/4acd161d511c09fdd7c03a39a1f951b9-1813feef9a87401c9b623cd22bfc5c3f-2.mp4,https://boot-video.xuexi.cn/video/1006/p/c37f66820c0cf0e81c5474e2c57aff79-81e0cc7302d84106bcdb60292b8b3cc2-2.mp4,https://boot-video.xuexi.cn/video/1006/p/1704f9bf212e0fbaa4c6d04f65be9de1-369be5079a2240ce940400afefdb46db-2.mp4,https://boot-video.xuexi.cn/video/1006/p/969d64b4913ac02814e30f005aeb397e-07ffba0f8e4448bb873eb2206a84ee38-2.mp4,https://boot-video.xuexi.cn/video/1006/p/054d48d4c6a8ba28c196d4acf6541ae5-87e960537bf64e688a73d8588cb62bd4-2.mp4,https://boot-video.xuexi.cn/video/1006/p/0e34f3200ecf5508f2f328865826afa5-9a97e4fb7e124b9ca602c66342011701-2.mp4,https://boot-video.xuexi.cn/video/1006/p/184426272dd5b1bad60f330c7e4c6027-263cfee68ee844bbb9a41acec1098753-2.mp4"""
    namestr = """回乡偶书二首·其一,题西林壁,枫桥夜泊,游子吟,春夜喜雨,出赛二首·其一,四时田园杂兴·其三十一,赠花卿,送元二使安西,江南逢李龟年,鸟鸣涧,石灰吟,芙蓉楼送辛渐,春日,竹石,黄鹤楼送孟浩然之广陵,凉州词二首·其一,江南春,独坐敬亭山,乌衣巷,乞巧,乐游原,六月二十七日望湖楼醉书,渔歌子,寒食,七步诗,月下独酌四首·其一,秋夜将晓出篱门迎凉有感(其二),蝉,山居球暝,秋夕,宿建德江,己亥杂诗(其二百二十),闻官军收河南河北,竹里馆,夏日绝句,长歌行,竹枝词二首·其一,墨梅,示儿,游园不值,题临安邸,题都城南庄,舟过安仁,天竺寺八月十五日夜桂子,登飞来峰,咏华山,劝学,天净沙·秋,早春呈水部张十八员外(其一),春雪,溪居即事,京师得家书,乡村四月,山中送别,游山西村,晚春,过故人庄,咏白鹭,蚕妇,冬夜读书示子聿,秋思,相思,浪淘沙,游钟山,渡汉江,西江月·夜行黄沙道中,梅花,宿新市徐公店,嫦娥,约客,易水送别,江雪,舟夜书所见,暮江吟,三衢道中,望洞庭,小儿垂钓,山行,晓出净慈寺松林子方,赋得古原草送别,夜书所见,早发白帝城,九月九日忆山东兄弟,忆江南,雪梅·其一,望庐山瀑布,大林寺桃花,滁州西涧,饮湖上初晴后雨二首·其二,绝句二首·其一,所见,采莲曲,望天门山,别董大二首·其一,江畔独步寻花·其六,夜宿山寺,鹿柴,咏柳,登鹳雀楼,村居,小池,过华清宫(其一),悯农二首(其二),商山早行,明日歌,绝句,春晓,题画,书湖阴先生壁(二首其一),春望,画鸡,蜂,池上,问刘十九,菩萨蛮·书江西造口壁,山村咏怀,静夜思,牧童,清平乐·村居,赠汪伦,梅花,峨眉山月歌,夜雪,咏鹅,古朗月行(节选),十二月十五夜,悯农二首·其一,汉乐府·江南,寻隐者不遇,画"""
    urls_list = urlstr.strip().split(",")
    names_list = namestr.strip().split(",")
    print(urls_list)
    print(len(urls_list))    # 131
    print(names_list)
    print(len(names_list))   # 131
    # for i in range(len(urls_list)):
    for i in range(10):
        download_mp4_by_url(urls_list[i], names_list[i], i+1)


if __name__ == "__main__":
    main()

  • 上面和下面的程序唯一的差别就是字符的间隔方式,上面是逗号间隔,下面是回车间隔,上面会让程序行数不那么多。
# https://article.xuexi.cn/articles/video/index.html?art_id=294702920556063797
import requests
import os


def download_mp4_by_url(url, name, n):
    """
    通过链接下载视频链接下载相应的mp4视频。
    :param url: mp4视频超链接。
    :param name: 视频保存的主题名
    :param n: 视频的顺序编号
    :return:
    """
    headers = {
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36 Edg/123.0.0.0"
    }
    video_data = requests.get(url, headers=headers).content
    if not os.path.exists("./视频"):
        os.mkdir("./视频")
    with open(f"./视频/{n}.{name}.mp4", "wb") as f:
        f.write(video_data)
        print(f"正在下载第{n}个视频:{name}")


def main():
    urlstr = """
https://boot-video.xuexi.cn/video/1006/p/5fd0919e562a1eedd1a8f740849f491a-72ee9dcf0fa440d7b8974dbea2538d39-2.mp4
https://boot-video.xuexi.cn/video/1006/p/7556c7043e88186b0bfb60a1abe27481-610517fe75974eef92edaf44fd579853-2.mp4
https://boot-video.xuexi.cn/video/1006/p/29057017b697b69ba089b141ffa7155b-72dba5794ada485fa36916ca6c4bb276-2.mp4
https://boot-video.xuexi.cn/video/1006/p/6cf3b6826f95653511f5dd8ea42b95c9-ff6425a5b1db4fc9b406c42480ebaae4-2.mp4
https://boot-video.xuexi.cn/video/1006/p/dca2b2122efa84ef43c0cf3c05b728d4-60f0576258944bea936d0aea6d9e9e50-2.mp4
https://boot-video.xuexi.cn/video/1006/p/e7c7db360b47191742ef7266aa509573-11044cf3d6d643619924122f2374bf2b-2.mp4
https://boot-video.xuexi.cn/video/1006/p/ae79b9d0c3391a1380a866a9ce2c781a-e5b2e7be528e4d59802175f2d74af5a9-2.mp4
https://boot-video.xuexi.cn/video/1006/p/d3e06265dadc66fd354649793d8aa75e-da7788f2a0984b87b67ff1d6f3e6d6a7-2.mp4
https://boot-video.xuexi.cn/video/1006/p/5613cceb7b31f3eefb8d3c1d1279be47-b9f0d1d881474f16a057c049056daa3b-2.mp4
https://boot-video.xuexi.cn/video/1006/p/0a3767c3924b2d0dc29b8e9c802a81da-46e9198132224d58a79abaf184b39c39-2.mp4
https://boot-video.xuexi.cn/video/1006/p/f5337dcf1029d1755d15b39e1bb34733-2a696096f6614b1780858c64ce8a29c5-2.mp4
https://boot-video.xuexi.cn/video/1006/p/fa1beb92f52913d5d0502e3fa5f096d5-1e0f65c5f8c8406eb34b6210670033c9-2.mp4
https://boot-video.xuexi.cn/video/1006/p/38566457defcadd3b6d9132a38d6ab29-0b349aaffb9c496287f4e1ef64876e86-2.mp4
https://boot-video.xuexi.cn/video/1006/p/5f8b2eb6b9dea34354d05d67f1882ada-b8ec6f074f064290a1182c6ccdae7eba-2.mp4
https://boot-video.xuexi.cn/video/1006/p/731132a6d4d87f7b9e0b9a94a65a5a06-dcf3f148b0c04724b320c7956caedf86-2.mp4
https://boot-video.xuexi.cn/video/1006/p/03a8ba3d09d1c4753546f5b3550a9251-8cec7ba4c26f4bc2bc7a6540cfb0fc7b-2.mp4
https://boot-video.xuexi.cn/video/1006/p/77cdb7969c3fef76cb1615f3c0718a46-5b6cccd988bb40a9a4fdc271061a336f-2.mp4
https://boot-video.xuexi.cn/video/1006/p/527970e4c8030524654803d3d159dbc8-6286fef291be46d5af41900f6988d1d4-2.mp4
https://boot-video.xuexi.cn/video/1006/p/1d6d6e6abd84ceb6368f039aa086a01c-a37df97a4cdf4212ab1982ce7dae1ab7-2.mp4
https://boot-video.xuexi.cn/video/1006/p/af756c8900e9c9b6b54412abb39be9ab-e37dd2b6537846b3a916e35d5dd99b52-2.mp4
https://boot-video.xuexi.cn/video/1006/p/271c0ec735a04cc00b9d13986d7cd65b-83c9c880f0bb4f07a103693f34aa9a95-2.mp4
https://boot-video.xuexi.cn/video/1006/p/29beed2e15abfbe3ba457a6a8d1d1c9c-660da4a738354dd09325aecfab268a43-2.mp4
https://boot-video.xuexi.cn/video/1006/p/a421df188b71340d3d0fee3a1e19fe14-d12daf58c6b24a14b46e6c7e5dc191ea-2.mp4
https://boot-video.xuexi.cn/video/1006/p/2771da94f2ce433a17ff61f8b870bb56-7fe1239fec054348ab1a281616bc146c-2.mp4
https://boot-video.xuexi.cn/video/1006/p/0fde550a85cca3c08a8c1356e21b760b-6be5b3e2d1a34fbd84f69dc955ace72d-2.mp4
https://boot-video.xuexi.cn/video/1006/p/418eb399a3e67bce6ef6748e848107a2-24b9382f5fa94b23ba09477508ba574f-2.mp4
https://boot-video.xuexi.cn/video/1006/p/f82578fa00d98c2d5369661b4a833d70-ef9baf0d218f4bebb25d7ed57db15451-2.mp4
https://boot-video.xuexi.cn/video/1006/p/42466a20053129df040b6dc39af56318-376df6c52bd940229b22aeab66273800-2.mp4
https://boot-video.xuexi.cn/video/1006/p/a153916e82b6c2b0c839dffbba49dec8-721d3890f73c404996508806848fd353-2.mp4
https://boot-video.xuexi.cn/video/1006/p/6d992bc4a29759ca59c0271ef82c95a8-8c120ce367e34ef799868ba1d0446180-2.mp4
https://boot-video.xuexi.cn/video/1006/p/a1a44024fd503a83381f7d8d617f7a5b-79d8b33098b4415db91cfd1ccfdad1f0-2.mp4
https://boot-video.xuexi.cn/video/1006/p/bc811f4dca003b28fd650b1d49c5ba0e-6e443a4230014feb954822a7d68e0c85-2.mp4
https://boot-video.xuexi.cn/video/1006/p/af274d40ddaa2f92d813d5cb6929e4ce-0f11ba22431c49b18701bbc69c300058-2.mp4
https://boot-video.xuexi.cn/video/1006/p/41ff8cabc43fb9bc03ce7fcc0b00eab3-eddc63b4e0e54c2bbede9ed5f02f73be-2.mp4
https://boot-video.xuexi.cn/video/1006/p/8fa92f5e955de50dad8f5e6cd6d9f7ef-30147986d805487f897295f5f13cd13b-2.mp4
https://boot-video.xuexi.cn/video/1006/p/e643da5bde09e6cd536b19ba755063cc-c54a968d54b7401484d85c2c78920e8f-2.mp4
https://boot-video.xuexi.cn/video/1006/p/0a2edf04db75c690a612e5447ee5a070-f907ddf5c87e4456b1a9dc84d79ea3dd-2.mp4
https://boot-video.xuexi.cn/video/1006/p/5e0d7314991de52da8d5b1567813512d-3398307fc32f42cc977f8133f803b76f-2.mp4
https://boot-video.xuexi.cn/video/1006/p/89dd21b2a52faa3c0b75ac1fca03b7cf-745f01a55bc544c4a62464b6e99903d8-2.mp4
https://boot-video.xuexi.cn/video/1006/p/bb9d200a5ed90d19a34265d0f74fe6cf-e6bd05f32ba143e8a40d71d9667e740b-2.mp4
https://boot-video.xuexi.cn/video/1006/p/957e47de4370b3c73c065bd802c52c01-c9d90b11e50f43bf9de79fa56679784c-2.mp4
https://boot-video.xuexi.cn/video/1006/p/cfaf1576ba3b1df2fb8d1b4cfab5d26f-b2e0841da56940a7ad56340633fc6471-2.mp4
https://boot-video.xuexi.cn/video/1006/p/dba15bb80b59fbe6ab95f7360d67bc11-804eb20577ab4877bd7cda30d119ac3e-2.mp4
https://boot-video.xuexi.cn/video/1006/p/8f6d37ca8d45421b468617407df5c95f-37ee2e67fbec4a47844ec3e1ad6f6040-2.mp4
https://boot-video.xuexi.cn/video/1006/p/31176f17aeb61a6d32f960f4bd4a0686-8429f54b53f04a00b24c0bbe2817a686-2.mp4
https://boot-video.xuexi.cn/video/1006/p/5eddff452cad6fe4297e89057799e6bb-3a20a92776334dd08b7b12b5befeaf42-2.mp4
https://boot-video.xuexi.cn/video/1006/p/4aa35925803a1693b35f33736f90dd25-a29d01ca9e7440778fe1b40d78734415-2.mp4
https://boot-video.xuexi.cn/video/1006/p/d29e527934c0556141964732ff3220a1-0ec288d0ddbd44d09cd216678d791933-2.mp4
https://boot-video.xuexi.cn/video/1006/p/0b46fda6f873b0623dd981e157f7e014-acb282c7a3cd477fb72b062227815890-2.mp4
https://boot-video.xuexi.cn/video/1006/p/9f6164c2950b2d37e816fbd7c8c49347-716d290572d84d98ad301c07c17de5cb-2.mp4
https://boot-video.xuexi.cn/video/1006/p/986491bd130e85fddc048eb759cec2fd-56620b7bd08d4ee491db3aa5e7b283e2-2.mp4
https://boot-video.xuexi.cn/video/1006/p/56054bf540fa797e71e3f866c24a09ce-8e9cbf1476ef4dca9b6a7d3bdbfaaf90-2.mp4
https://boot-video.xuexi.cn/video/1006/p/2c7adba23f684e661a7a72766c8a9c17-d734f23b6cbb4ac58dc65ed0cfb42568-2.mp4
https://boot-video.xuexi.cn/video/1006/p/631cb0e564b1944c9ecd957c34a57e88-7c10d4b506d84a8eb03e65b18375ef38-2.mp4
https://boot-video.xuexi.cn/video/1006/p/43ea00ebb945581bf72cde9ca89f2da6-08b1848464374392841074537a34b02d-2.mp4
https://boot-video.xuexi.cn/video/1006/p/46bfe422e70f5d28e248f9ab0d121c38-3e07163b3488418d9ac47fc1798b6bf6-2.mp4
https://boot-video.xuexi.cn/video/1006/p/83f771f0bd7369059b77c3b56ccf7664-9fc2cb92c367485887ea27da8aca904e-2.mp4
https://boot-video.xuexi.cn/video/1006/p/2ee715f21f61106f83e4f901426f136c-1e928dd5f7894ec98cf01123cecd0cab-2.mp4
https://boot-video.xuexi.cn/video/1006/p/a21341b0f5365a32fb8ae2313ae4fc7f-70ec698a68504d74ac87ef4d85f2dec9-2.mp4
https://boot-video.xuexi.cn/video/1006/p/6d3df788e997368bf7163d0dea38acae-0a23ca135101497f931409eed598b5b1-2.mp4
https://boot-video.xuexi.cn/video/1006/p/83ff2a8a6450a5983469c043dfd2ab9b-a03cf7420bf14e809c3501c9cba48cc6-2.mp4
https://boot-video.xuexi.cn/video/1006/p/52c48538b7008cdd480567dea643fa1d-5067f428d79d4758adf6931011a243ec-2.mp4
https://boot-video.xuexi.cn/video/1006/p/6f79a0cd7731e53de00aef3f77b6ba75-1b9f9f0f3318445c8714db7177c75eed-2.mp4
https://boot-video.xuexi.cn/video/1006/p/502ca838457f46985e7d339c9dd94d84-7b79ac473f62441fbc6191ad1c0ed4ef-2.mp4
https://boot-video.xuexi.cn/video/1006/p/f2dfec5d09fd5c3d7b06d65be1afbf44-5124232c0efd41a2b28dd1a5fd991ff9-2.mp4
https://boot-video.xuexi.cn/video/1006/p/29a6bdcbda1d9360fa4c97add1b21258-a6b68866bc8748398a2ac6ff8f1340ad-2.mp4
https://boot-video.xuexi.cn/video/1006/p/1f57dd2a0cf5b7e97e63c6e884087a90-a0a325f1bb2849f5a467bb997bf21878-2.mp4
https://boot-video.xuexi.cn/video/1006/p/70f2c3fb09c7c798c18ea2e64e64252b-40629663598848f6a5ea55ae7fc95732-2.mp4
https://boot-video.xuexi.cn/video/1006/p/ce6daa2b530771a5f69b207e011e82cb-57309ee44bf944e48a79b9b09c84c758-2.mp4
https://boot-video.xuexi.cn/video/1006/p/4961b8cd99003f6f41382e4ebb89fcef-51bd8225f3b149239c18f6b300b48f0f-2.mp4
https://boot-video.xuexi.cn/video/1006/p/73f29350eb985704089b7b61a6eaf3e4-c7f4b173d8dd4195b61242f14ef15c46-2.mp4
https://boot-video.xuexi.cn/video/1006/p/a219b07be0bc35ff41ad5ebf068dc34f-e6736b582b2b4591aa4f100f8b94b7ab-2.mp4
https://boot-video.xuexi.cn/video/1006/p/410a9f2f0b6192bdbdaa39396221f52c-6852abed973d42349d4c9bedbc550f6b-2.mp4
https://boot-video.xuexi.cn/video/1006/p/2ab710a6ce7ddaf96aa1b28e0cf4f6c3-abcb2769e33347559f5e8d2b286b3dd3-2.mp4
https://boot-video.xuexi.cn/video/1006/p/15f6c34100bf876c7dcc0049592d683e-734f90bde3904afa98580647fdbe398b-2.mp4
https://boot-video.xuexi.cn/video/1006/p/71ce68defb78b286f976b4530a830a6f-98b9f922db814055b52f4a8f9281bafc-2.mp4
https://boot-video.xuexi.cn/video/1006/p/3a2c3bb124c84f6a917db9e048692f70-bbae575fb9ff4eafb32cc78fecd1177d-2.mp4
https://boot-video.xuexi.cn/video/1006/p/af73e42dffa0206148713cd5555eceb7-1c22d2375710400d8e7c3f4071e5e644-2.mp4
https://boot-video.xuexi.cn/video/1006/p/88e36e96e5a09720aae36b67ed7c18f6-767d5dc02b2f46c18c202726bdd3fcee-2.mp4
https://boot-video.xuexi.cn/video/1006/p/8529ebb9aa153b4d04325e8584b1cd44-8cc16ecb8ad2441ebedf9d3cef76ebb5-2.mp4
https://boot-video.xuexi.cn/video/1006/p/4cbcf0776115a5a2409743c6286a7518-19c79ec4844646e78a12066c9d60e56b-2.mp4
https://boot-video.xuexi.cn/video/1006/p/cff211b0944565f0957ce65053239889-f485890a475047eebf81676a914acf96-2.mp4
https://boot-video.xuexi.cn/video/1006/p/649a17f375e581227c785f07f008164b-ff245af5c0b34118b118783865876148-2.mp4
https://boot-video.xuexi.cn/video/1006/p/395bfdbbfa2a13c48b42dffe60a964bb-db31575eb79548f087c8529fe8c57516-2.mp4
https://boot-video.xuexi.cn/video/1006/p/8c52ce19002c1b856d0efdacc1038db8-bc33fa71867440b8a62c34b1f59b4cba-2.mp4
https://boot-video.xuexi.cn/video/1006/p/3d0bfb2473842a295440720e7542bbba-43027d30f1bb49849fadf3f3679f913c-2.mp4
https://boot-video.xuexi.cn/video/1006/p/519b8af4b34e66ae125d551241434a83-eefe47cb08f24a63bf909094014676dd-2.mp4
https://boot-video.xuexi.cn/video/1006/p/fec74636fee82ccf3f47c5a1b96ba3ca-2e0d6d812d994b8693f77c813034ca27-2.mp4
https://boot-video.xuexi.cn/video/1006/p/3ce509ee964328884c429c416316e6eb-6d2ee7402de84677869bd6f44e408e1a-2.mp4
https://boot-video.xuexi.cn/video/1006/p/bd622a6f00cae493ca1205a035c93bf3-7224ed9b66d14cd1bd472637fc454853-2.mp4
https://boot-video.xuexi.cn/video/1006/p/02797843a2932a33e05ab8fa2b554d42-389940076e71460398a864ea6c32570c-2.mp4
https://boot-video.xuexi.cn/video/1006/p/da464b41516e6f53e1958d2f5702f53d-f614569db0f14e0ca1599222c17fb327-2.mp4
https://boot-video.xuexi.cn/video/1006/p/3ec09182194483e86ec42aa9cf5599f2-bdba19cc1ad84deb847bc6f1b70534eb-2.mp4
https://boot-video.xuexi.cn/video/1006/p/7b26c133b0cfca42ecf2ccbbfc36e689-42b9ff237c884d4dbce2a2842c8faf53-2.mp4
https://boot-video.xuexi.cn/video/1006/p/ad2d5062484e74e05641810d06e71c25-879dfddb8e0049c19680ae7bdff7a403-2.mp4
https://boot-video.xuexi.cn/video/1006/p/1cc397e194d914206a193a0dcbaaf649-f91e7a62bbdf4c4eafd27555096644e2-2.mp4
https://boot-video.xuexi.cn/video/1006/p/b0360d98873df7e7854e30e20dabd107-6e2cdd39c434474cbe408bcc4eeb0594-2.mp4
https://boot-video.xuexi.cn/video/1006/p/d5b209f3d6f05c4adbecab5dd415d58a-45c825d86b0640b5a20b445dd9ee1dc2-2.mp4
https://boot-video.xuexi.cn/video/1006/p/98bef60af42e3d6471bf1df948271118-58f6145b62d044fa9b5fa6ab86b64903-2.mp4
https://boot-video.xuexi.cn/video/1006/p/eb44453847aa49b61a174aec80abfc24-c0eb3b0efe794496b46a7fc22c5b969d-2.mp4
https://boot-video.xuexi.cn/video/1006/p/229f90b1ebf77732b3e6b426b82b07c0-92a75187186342d98630cc271b4efe5f-2.mp4
https://boot-video.xuexi.cn/video/1006/p/2be1df82bd23510e11257533486ecd23-77cdbfbe7f104d04acb276c4f6587b78-2.mp4
https://boot-video.xuexi.cn/video/1006/p/c46ee3226a22101331473c2397149c6f-69e2474d16e94f399d21a1d443b7c4c8-2.mp4
https://boot-video.xuexi.cn/video/1006/p/135ff5aba7cd42529db9f43e06149cd0-f6260aafb4514ba3915288e7b8bb2c3d-2.mp4
https://boot-video.xuexi.cn/video/1006/p/e9e0d0dce252ead465243991dead1585-d946b3e7c002413fbcd3f949813a7be4-2.mp4
https://boot-video.xuexi.cn/video/1006/p/a5b6ed955d7769af321c29b33059e545-2ffef5615a69435dbc93b7385072514c-2.mp4
https://boot-video.xuexi.cn/video/1006/p/f71231f0ff95a31d883e7a459d7ac7a5-59d3a7417c3a4671b7e75da2646097a7-2.mp4
https://boot-video.xuexi.cn/video/1006/p/14b972a46469283fe35ab9dc1746ca2e-be534fd49c23443898886d25084a5b24-2.mp4
https://boot-video.xuexi.cn/video/1006/p/aa1c1d3b2055f8e4e8e4bd135e162c0f-76aa004b273f4755a0d7a81fed81cf14-2.mp4
https://boot-video.xuexi.cn/video/1006/p/96ad67bd488fbee5edc05d882e687e46-78719eefb76c4b3d98db80c312e6060f-2.mp4
https://boot-video.xuexi.cn/video/1006/p/23c5b6b4a2a68c2555f4bc742236ca9b-a8298be10a9c4fbaa81c2cea3072932d-2.mp4
https://boot-video.xuexi.cn/video/1006/p/a1675428e11e764fbd1768b7f574b232-b7a9f438df8344f5861864c75e0bc9dd-2.mp4
https://boot-video.xuexi.cn/video/1006/p/e978f876a8417a42b21fdc980aff8925-778554c730d44be98bfe99352328479b-2.mp4
https://boot-video.xuexi.cn/video/1006/p/aac5acc7939a9590043d86be9f069e2d-ee3d8dbccb074707a1abf50ee4ea1cae-2.mp4
https://boot-video.xuexi.cn/video/1006/p/6a8657cc800fcbdebdc8f65864c4ebe4-e581f011019948dc98f37039085fc1b6-2.mp4
https://boot-video.xuexi.cn/video/1006/p/131c9b7e970f2b1cb289ee1f23ad4d4c-fc11d379a8d74699bc14f31ec61d5d9f-2.mp4
https://boot-video.xuexi.cn/video/1006/p/e8aea8cf65437dd1a6a3ee4f64150926-9171928858d64378b75e5f44171e3806-2.mp4
https://boot-video.xuexi.cn/video/1006/p/cb2393a3288c22fb33c118b47962731a-0fcc03caa2a04a0bb28314d5a5c55bfd-2.mp4
https://boot-video.xuexi.cn/video/1006/p/8d90b321cdab66934de7988d79f42d11-a5b1bf245b5048f29de29b28f0cf4b29-2.mp4
https://boot-video.xuexi.cn/video/1006/p/f0f79d4991d24406c4b1000808866aed-efbe26a5306c45df972488689c0ac6ca-2.mp4
https://boot-video.xuexi.cn/video/1006/p/e0fb2e96085f1f5db5f7492c212654c2-904f1c1ae17d4128a7af950eb010124d-2.mp4
https://boot-video.xuexi.cn/video/1006/p/19923f0e72ca7b750bf112796a14cda9-e6d6acb0e08f4b84aaf8f31dfd4ba09a-2.mp4
https://boot-video.xuexi.cn/video/1006/p/3e72c126a54dc9c8093b4301a8639a94-3f4b29907d8543c58dd2046ad853e415-2.mp4
https://boot-video.xuexi.cn/video/1006/p/22a8b76f1af75caca3bfdd47ad5ba8af-1c745b99a01c4a0a86e6ee0365aad457-2.mp4
https://boot-video.xuexi.cn/video/1006/p/4acd161d511c09fdd7c03a39a1f951b9-1813feef9a87401c9b623cd22bfc5c3f-2.mp4
https://boot-video.xuexi.cn/video/1006/p/c37f66820c0cf0e81c5474e2c57aff79-81e0cc7302d84106bcdb60292b8b3cc2-2.mp4
https://boot-video.xuexi.cn/video/1006/p/1704f9bf212e0fbaa4c6d04f65be9de1-369be5079a2240ce940400afefdb46db-2.mp4
https://boot-video.xuexi.cn/video/1006/p/969d64b4913ac02814e30f005aeb397e-07ffba0f8e4448bb873eb2206a84ee38-2.mp4
https://boot-video.xuexi.cn/video/1006/p/054d48d4c6a8ba28c196d4acf6541ae5-87e960537bf64e688a73d8588cb62bd4-2.mp4
https://boot-video.xuexi.cn/video/1006/p/0e34f3200ecf5508f2f328865826afa5-9a97e4fb7e124b9ca602c66342011701-2.mp4
https://boot-video.xuexi.cn/video/1006/p/184426272dd5b1bad60f330c7e4c6027-263cfee68ee844bbb9a41acec1098753-2.mp4
"""
    namestr ="""回乡偶书二首·其一
题西林壁
枫桥夜泊
游子吟
春夜喜雨
出赛二首·其一
四时田园杂兴·其三十一
赠花卿
送元二使安西
江南逢李龟年
鸟鸣涧
石灰吟
芙蓉楼送辛渐
春日
竹石
黄鹤楼送孟浩然之广陵
凉州词二首·其一
江南春
独坐敬亭山
乌衣巷
乞巧
乐游原
六月二十七日望湖楼醉书
渔歌子
寒食
七步诗
月下独酌四首·其一
秋夜将晓出篱门迎凉有感(其二)
蝉
山居球暝
秋夕
宿建德江
己亥杂诗(其二百二十)
闻官军收河南河北
竹里馆
夏日绝句
长歌行
竹枝词二首·其一
墨梅
示儿
游园不值
题临安邸
题都城南庄
舟过安仁
天竺寺八月十五日夜桂子
登飞来峰
咏华山
劝学
天净沙·秋
早春呈水部张十八员外(其一)
春雪
溪居即事
京师得家书
乡村四月
山中送别
游山西村
晚春
过故人庄
咏白鹭
蚕妇
冬夜读书示子聿
秋思
相思
浪淘沙
游钟山
渡汉江
西江月·夜行黄沙道中
梅花
宿新市徐公店
嫦娥
约客
易水送别
江雪
舟夜书所见
暮江吟
三衢道中
望洞庭
小儿垂钓
山行
晓出净慈寺松林子方
赋得古原草送别
夜书所见
早发白帝城
九月九日忆山东兄弟
忆江南
雪梅·其一
望庐山瀑布
大林寺桃花
滁州西涧
饮湖上初晴后雨二首·其二
绝句二首·其一
所见
采莲曲
望天门山
别董大二首·其一
江畔独步寻花·其六
夜宿山寺
鹿柴
咏柳
登鹳雀楼
村居
小池
过华清宫(其一)
悯农二首(其二)
商山早行
明日歌
绝句
春晓
题画
书湖阴先生壁(二首其一)
春望
画鸡
蜂
池上
问刘十九
菩萨蛮·书江西造口壁
山村咏怀
静夜思
牧童
清平乐·村居
赠汪伦
梅花
峨眉山月歌
夜雪
咏鹅
古朗月行(节选)
十二月十五夜
悯农二首·其一
汉乐府·江南
寻隐者不遇
画
"""
    urls_list = urlstr.strip().split("\n")
    names_list = namestr.strip().split("\n")
    print(urls_list)
    print(len(urls_list))    # 131
    print(names_list)
    print(len(names_list))   # 131
    # for i in range(len(urls_list)):
    for i in range(10):
        download_mp4_by_url(urls_list[i], names_list[i], i+1)


if __name__ == "__main__":
    main()