The boring mass download program for photo album photos

Source: Internet
Author: User

The urlresource class used by this program can be found here

Http://blog.csdn.net/laizhenhai88/article/details/7430844

 

Although the PS in the photo of passers-by is quite powerful, I wrote a very bad program to download it.

The idea is simple, and the program has poor versatility. First, retrieve the link addresses of the first to second phases from a Web page, and then retrieve the 50th pages to the last pages from each phase. Download the image and save it to the D: \ luren2 folder.

 

There is no reference program, but it can be used to download beautiful pictures. Haha.

Procedure:

1. Make sure that the D: \ luren2 folder

2. Run the program to save the image to the folder. About 3000 sheets

 

Import Java. util. arraylist; import Java. util. regEx. matcher; import Java. util. regEx. pattern; public class luren {public static void main (string [] ARGs) {try {// first find a link to download the address list string detail = urlresource from phase 1 to phase 2. geturldetail ("http://www.luren.cc/new_list/20120404/8056185.shtml", false); pattern Reg = pattern. compile ("<a target = \" _ blank \ "href = \" ([^ \ "] +) \"> "); matcher = reg. matcher (detail); int I = 0; ar Raylist <string> links = new arraylist <string> (); arraylist <string> links2 = new arraylist <string> (); While (matcher. find () {string q = matcher. group (1); If (Q. indexof ("new_list ")! =-1) {links. add (Q); I ++ ;}// judge the weight for (string S: links. toarray (New String [0]) {If (! Links2.contains (s) {links2.add (s); // system. out. println (s) ;}// system. out. println (links2.size (); string base = NULL; int imgnum = 1; int oldnum = 1; for (string URL: links2) {// string url = "http://www.luren.cc/new_list/20120217/46343.shtml "; base = URL. substring (0, URL. lastindexof ("/") + "/"; string d = urlresource. geturldetail (URL, true); // system. out. println (d); matcher m3 = pattern. compile ("<P style = \" Text-align: Center .? \ "> <A [^ h] * href = \" [^ \ "] + \">  "); matcher matcher2 = reg2.matcher (DM); While (matcher2.find ()) {string D2 = urlresource. geturldetail (base + matcher2.group (1), true); matcher M33 = pattern. compile ("<P style = \" text-align: Center .? \ "> <A [^ h] * href = \" [^ \ "] + \"> 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.