This is a created article in which the information may have evolved or changed.
Previously wrote a crawl of the movie site project, there is a movie poster crawl, today, the crawling feature extracted into a small example to take out.
package mainimport ("bytes""fmt""io""io/ioutil""net/http""os""regexp")func main() {imagPath := "http://img2.bdstatic.com/img/image/166314e251f95cad1c8f496ad547d3e6709c93d5197.jpg"reg, _ := regexp.Compile(`(\w|\d|_)*.jpg`)name := reg.FindStringSubmatch(imagPath)[0]fmt.Print(name)resp, _ := http.Get(imagPath)body, _ := ioutil.ReadAll(resp.Body)out, _ := os.Create(name)io.Copy(out, bytes.NewReader(body))}
Can first use the crawler to get the original code of the page, and then use regular and other means to analyze the image of the address, and finally use the above code to crawl the picture.
Original address: http://www.1025m.com/33.html