源码如下:
# -*- coding: utf-8 -*-
# @Time : 2017/5/18 17:38
# @Author : xiaojingjing
# @Site :
# @File : finde_mmimg.py
# @Software: PyCharm
import urllib.request
import os,shutil
def url_open(url):
req=urllib.request.Request(url)
req.add_header('User-Agent','Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36')
response=urllib.request.urlopen(url)
html=response.read()
return html
def get_page(url):
html=url_open(url).decode('utf-8')
a=html.find('current-comment-page')+23
b=html.find(']',a)
return html[a:b]
def find_imgs(url):
html=url_open(url).decode('utf-8')
img_addrs=[]
a=html.f