python 爬取周杰伦歌曲信息

#爬取的信息不在网页源代码里所以用json解析
import requests
# 引用requests库
res_music = requests.get('https://c.y.qq.com/soso/fcgi-bin/client_search_cp?ct=24&qqmusic_ver=1298&new_json=1&remoteplace=txt.yqq.song&searchid=60997426243444153&t=0&aggr=1&cr=1&catZhida=1&lossless=0&flag_qc=0&p=1&n=20&w=%E5%91%A8%E6%9D%B0%E4%BC%A6&g_tk=5381&loginUin=0&hostUin=0&format=json&inCharset=utf8&outCharset=utf-8&notice=0&platform=yqq.json&needNewCode=0')
# 调用get方法,下载这个字典
json_music = res_music.json()
# 使用json()方法,将response对象,转为列表/字典
list_music = json_music['data']['song']['list']
# 一层一层地取字典,获取歌单列表
for music in list_music:
    # list_music是一个列表,music是它里面的元素
    print(music['name'])
    # 以name为键,查找歌曲名
    print('所属专辑:'+music['album']['name'])
    # 查找专辑名
    print('播放时长:'+str(music['interval'])+'秒')
    # 查找播放时长
    print('播放链接:https://y.qq.com/n/yqq/song/'+music['mid']+'.html\n\n')
    # 查找播放链接

我来吐槽

*

*

已有 24 条评论

  1. Breanna Stretch

    Hello,

    It is with sad regret to inform you that DataList.biz is shutting down. We have made all our databases available for you at a one-time fee.

    You can visit us on DataList.biz

    Regards.
    Breanna

  2. Franchesca Robbins

    It is with sad regret to inform you that BusinessLeads101.com is shutting down.

    We have over 300 million records available for a one time fee of $149.

    Please visit our website BusinessLeads101.com

    Regards,
    Franchesca

  3. Alanna Beor

    Hello.

    We are offering Bullet Proof SMTP servers that never get suspended. Email as much as you want.

    DMCA ignored, bulletproof locations, 100% uptime guaranteed, unlimited data transfer, and 24/7/365 support.

    100 Spots available. BulletProofSMTP.org

  4. Constance Barff

    Hello.

    It is with sad regret to inform you TopDataList.com is shutting down.

    We have made all our databases available for you for a once off fee.

    Visit us on TopDataList.com

  5. Torsten Bond

    Hello, from CustomData.click we are a provider of unique databases that could help your business.

    Please visit us at CustomData.click to see if we can help you.

    Regards,
    Torsten

  6. Josephine De Gillern
    Josephine De Gillern May 18th, 2022 at 01:20 am 回复

    Hi, my name is Josephine from TopDataList.com

    We are ceasing operations on TopDataList.com and have made our leads available at a discounted price.

    Visit us on TopDataList.com
    Regards,
    Josephine

  7. Bruno Gresswell

    Hello, did you know that there are 241,120 internet directories in the world.

    These websites are what drive traffic to YOUR business.

    Want more traffic? Want more Sales? We can help - today.

    Your website wangwei520.top is listed in only 24 of these directories.

    Get more traffic for your Global audience.

    Our automated system adds your website to all of the directories.

    You can find it here: getlisted.directory/wangwei520.top

    Act today, and we will expedite your listings and waive the processing charge!

  8. Adam Murdock

    Convert wangwei520.top to an app with one click!

    80% of users browse websites from their phones.

    Have the App send out push notifications without any extra marketing costs!

    MakeMySiteMobile.com

  9. Chantal Doyne

    Hello, did you know that there are 241,120 internet directories in the world.

    These websites are what drive traffic to YOUR business.

    Want more traffic? Want more Sales? We can help - today.

    Your website wangwei520.top is listed in only 24 of these directories.

    Get more traffic for your Global audience.

    Our automated system adds your website to all of the directories.

    You can find it here: getlisted.directory/wangwei520.top

    Act today, and we will expedite your listings and waive the processing charge!

    We have a special going on. Use "FRIENDS" on checkout for a 50% discount valid today.

  10. clourgy

    Cialis Levitra Farmacia can i buy cialis without a prescription Cialis Soft Prix

  11. Entenedat

    cialis dosage If you re real with us we ll more than likely happily take the product for review, be persuasive persistent and we ll likely be annoyed and remain unimpressed

  12. Keysler

    cialis prices Comments ratings on the side effects, benefits, and effectiveness of tadalafil oral

  13. experly

    Roman also charges 10 for the same thing priligy dosage We know that when it comes to your health, you want only the best

  14. wainnef

    can i buy priligy in usa Any change in the strength and dosage of the drug is to be done only with the permission of the doctor

  15. Litimitte

    buy generic cialis online cheap The throne of the magician can not be kept now, and it will be fought for later

  16. ruinkix

    Is Cialis or Viagra more effective buy cialis online overnight shipping A total of 427 men who completed the 12-week, placebo-controlled, dose-finding study assessing once-daily tadalafil 2

  17. SokSwette

    cialis prices Our guide to Cialis side effects goes into more detail about the potential side effects associated with Cialis, as well as the steps that you can take to deal with them if you re affected

  18. Nizscoons

    Most reviewers who mixed the two admitted that they refrained from doing this a second time cialis online india

  19. hustype

    Seek medical attention right away if any of these SEVERE side effects occur Severe allergic reactions rash; hives; itching; difficulty breathing; tightness in the chest; swelling of the mouth, face, lips, or tongue increased risk of cancer of the ovaries; over stimulation of the ovaries; spontaneous abortion. when to take clomid

  20. Gearsella

    Our doctor and the head embryologist explained what happened very thoroughly and patiently. metformin and clomid While taking the pills I do get nauseous but I am fine once I stop taking them.

  21. furtuby

    Ok I will take 120mg but would like to start taking them now so I can get a better idea of when I will O come October. tamoxifen for weight loss

  22. ignisse

    Christiansen EH, Frost L, Andreasen F, et al. doxycycline for uti dosage how many days

  23. ziserse

    doxycycline 100 mg capsule pseudodiphtheriticum is a commensal of the human nasopharynx.