推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
0xsui
V2EX  ›  Python

求大神吐糟给点参考意见

  •  
  •   0xsui · Jul 17, 2018 via Android · 2640 views
    This topic created in 2880 days ago, the information mentioned may be changed or developed.

    python 初学者,小白一枚,写了一个咪咕音乐的爬虫,希望大神们给点语法和编程方法上参考意见😘 https://github.com/23171580/migu_music_spider

    7 replies    2018-07-17 15:30:52 +08:00
    0xsui
        1
    0xsui  
    OP
       Jul 17, 2018 via Android
    能把单个歌手的所有歌曲都下载下来,有点懵逼的就是有时候文件下载一会就报错😂
    kevin1234
        2
    kevin1234  
       Jul 17, 2018
    @0xsui 下载一会报错 具体是报错什么呢 你分析过没呢?
    0xsui
        3
    0xsui  
    OP
       Jul 17, 2018
    @kevin1234 一开始以为是请求太频繁,于是加了随机延时,出错几率小了。之后又加上 header,但是,如果歌手的歌单歌曲量很大,下载时间长了还是报错。
    0xsui
        4
    0xsui  
    OP
       Jul 17, 2018
    @kevin1234 ("Connection broken: ConnectionResetError(10054, '远程主机强迫关闭了一个现有的连接。', None, 10054, None)", ConnectionResetError(10054, '远程主机强迫关闭了一个现有的连接。', None, 10054, None))

    line 78, in song_download_save
    save_file('.mp3', music_name, 'wb+', dir_now, html_get(song_url, test_header).content)
    AttributeError: 'int' object has no attribute 'content'

    感觉还是因为访问太频繁了
    mario85
        5
    mario85  
       Jul 17, 2018 via iPhone
    做这种爬虫都得备个池子吧
    0xsui
        6
    0xsui  
    OP
       Jul 17, 2018
    @mario85 得准备个代理 ip 池吗?
    mario85
        7
    mario85  
       Jul 17, 2018 via iPhone
    @0xsui 是,建议学下反爬
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   911 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 22:27 · PVG 06:27 · LAX 15:27 · JFK 18:27
    ♥ Do have faith in what you're doing.