ysoren 发表于 2018-8-3 13:08:02

用python下载美剧《天蝎》

  本文是小强全栈测试开发班学员投稿,比心!
  前言
  为了看美剧《天蝎》,终于在电影天堂网站找到了,嘎嘎,于是就想下载下来好好欣赏。
  代码
  import requests,re,os,time
  #电影的URL地址
  url = "http://www.dygod.net/html/tv/oumeitv/109673.html"
  s = requests.get(url)
  # print(s.encoding) #打印下汉字的编码类型
  res = re.findall('href="(.*?)">ftp',s.text)
  for resi in res:
  #汉字转换成utf-8编码
  # print(i.encode("iso-8859-1").decode('gbk').encode('utf8').decode('utf8'))
  a=resi.encode("iso-8859-1").decode('gbk').encode('utf8').decode('utf8')
  print(a) #打印一下看下效果
  os.chdir("D:\Program Files (x86)\Thunder Network\Thunder\Program\")
  os.system("Thunder.exe -StartType:DesktopIcon "%s"" % a)
  time.sleep(1)
  运行代码后效果图:

  我用的是迅雷极速版,安装在D盘。
  注意:在进行下载之前需先启动迅雷
页: [1]
查看完整版本: 用python下载美剧《天蝎》