mrdoor

#coding=utf-8

 
import urllib
import re
 
def downloadPage(url):
    = urllib.urlopen(url)
    return h.read()
 
def downloadImg(content):
    pattern = r\'src="(.+?\.jpg)" pic_ext\'
    = re.compile(pattern)
    urls = re.findall(m, content)
 
    for i, url in enumerate(urls):
        urllib.urlretrieve(url, "%s.jpg" % (i, ))
 
content = downloadPage("http://tieba.baidu.com/p/2460150866")
downloadImg(content)
 
针对图片的批量下载 urllib提供了相关接口可以执行!

分类:

技术点:

相关文章:

  • 2021-11-29
  • 2021-05-14
  • 2021-08-16
  • 2021-11-29
  • 2021-11-29
  • 2021-04-26
  • 2021-11-30
  • 2021-11-23
猜你喜欢
  • 2021-11-23
  • 2022-02-09
  • 2022-02-09
  • 2021-11-29
  • 2021-09-17
相关资源
相似解决方案