) # image File.close () Downloadthread = Threading. Thread (TARGET=DOWNLOADXKCD (555, 557)) Downloadthread.start () # # Todo:create and start the thread objects# Downloadthreads = [] # A list of all the Thread objects# for I in range ($, ten): # Downloadthread = Thread Ing. Thread (TARGET=DOWNLOADXKCD, args= (i, i+9)) # downloadthreads.append (downloadthread) # Downloadthread.start () # # # TOD O:wait for all threads to end# for Downloadthread in downloadthreads:# downloadthread.join () # Print
Download the pictures on the specified website, only the first 100 pages of pictures, you can set the number of pages according to your needs
Cat value is a picture type, you can change your own cat value experience, have a question to me, see will answer
2 = Big breasted Sister
3 = US Leg control
4 = with a Yan value
5 = Hodgepodge
6 = Small Hips
Import request
#本程序功能: Download the Web image to local and save it by number. #使用Ruby1.9.3 is written under WINXP_SP3. Require ' Nokogiri ' require ' Open-uri ' #以下 parse the page based on the URL. page = nokogiri::html (open ("http://www.169bb.com/News/2014-12-20/093288.htm")) Arrlen = page.css (' img '). Lengthmypics = Array.new (Arrlen) #以下 the parsed image address into the mypics array. For x in 0...arrlenmypics[x] = PAGE.CSS (' img ') [x][' src ']end# the foll
Recently did Ali's video interface, very egg hurts, Ali's video capture cover picture is time limited, expired can not access, can only download after uploading.Nonsense not much to say directly on the codePublic actionresult uploadvideoimg (String URL){WebRequest request = webrequest.create (URL);WebResponse response = Request. GetResponse ();Stream reader = response. GetResponseStream ();listint temp = reader. ReadByte ();while (temp! =-1){bytes. Ad
); About Img.setimagebitmap (result); the } the } the + @Override - Public voidonCreate (Bundle savedinstancestate) { the Super. OnCreate (savedinstancestate);Bayi Setcontentview (r.layout.main); the the NewDownloadimagetask (). Execute ("Http://www.mayoff.com/5-01cablecarDCP01934.jpg"); - } -}Because the Downloadimage () method is synchronous-this means that no control is returned until the picture is downloaded-so calling it directly causes the active
PHP multi-thread batch collection and download of beautiful pictures implementation code (continued ). I personally think the cause of the impact: the matched image url is not a valid url. in this article, we simply judge whether it is a relative path, but some URLs are invalid solutions: this is the reason why I think the impact is added:
The url of the matched image is not a valid url. in this article, we
PHP multi-thread batch collection and download of beautiful pictures implementation code
The use of curl multithreading, In addition, curl can set the request time, in the event of a very slow url resource, you can decisively give up, so there is no blocking, and there are multi-threaded requests, the efficiency should be relatively high
The following is code implementation:
/**
* Curl Multithreadi
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.