paramatton
paramatton
2021-01-22 23:38

想从用urlretrieve下载mp3,但是每次都被跳转另一个mp3?

  • python

我写了简单程序 想从http://www.ting89.com/下载mp3

_opener = urllib.request.build_opener()
_opener.addheaders = [("User-agent", "Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko")]

url = urllib.parse.quote(_url_link, safe='/:?=')
try:
    _opener.open(url)
    
    urlretrieve(url, _path_local, cbk)

    
except Exception as e:
    print(e)

结果每次都只能下载一个网站自己的mp3,手动下载可以下载真正的mp3,是被反爬虫了吗?

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

0条回答