|
16 | 16 | $FileInfo: get_ylp.py - Last Update: 10/07/2013 Ver. 1.0.5 RC 6 - Author: cooldude2k $
|
17 | 17 | '''
|
18 | 18 |
|
19 |
| -import re, os, sys, urllib, urllib2, cookielib, StringIO, gzip, time, datetime, argparse, urlparse; |
| 19 | +import re |
| 20 | +import os |
| 21 | +import sys |
| 22 | +import urllib |
| 23 | +import urllib2 |
| 24 | +import cookielib |
| 25 | +import StringIO |
| 26 | +import gzip |
| 27 | +import time |
| 28 | +import datetime |
| 29 | +import argparse |
| 30 | +import urlparse |
20 | 31 |
|
21 |
| -fakeua = "Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Firefox/24.0""; |
22 |
| -geturls_cj = cookielib.CookieJar(); |
23 |
| -geturls_opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(geturls_cj)); |
24 |
| -geturls_opener.addheaders = [("Referer", "http://www.google.com/search?q=younglegalporn"), ("User-Agent", fakeua), ("Accept-Encoding", "gzip, deflate"), ("Accept-Language", "en-US,en-CA,en-GB,en-UK,en-AU,en-NZ,en-ZA,en;q=0.5"), ("Accept-Charset", "ISO-8859-1,ISO-8859-15,utf-8;q=0.7,*;q=0.7"), ("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"), ("Connection", "close")]; |
25 |
| -print("0 Reading URL: http://photos.younglegalporn.com/"); |
26 |
| -geturls_text = geturls_opener.open("http://photos.younglegalporn.com/"); |
27 |
| -if(geturls_text.info().get("Content-Encoding")=="gzip" or geturls_text.info().get("Content-Encoding")=="deflate"): |
28 |
| - strbuf = StringIO.StringIO(geturls_text.read()); |
29 |
| - gzstrbuf = gzip.GzipFile(fileobj=strbuf); |
30 |
| - out_text = gzstrbuf.read()[:]; |
31 |
| -if(geturls_text.info().get("Content-Encoding")!="gzip" and geturls_text.info().get("Content-Encoding")!="deflate"): |
32 |
| - out_text = geturls_text.read()[:]; |
33 |
| -regex_text = re.escape("<li><a href=\"http://photos.younglegalporn.com/")+"([a-fA-F0-9]{8})"+re.escape("/")+"([a-zA-Z0-9]{14})"+re.escape("/\"><img title=\""); |
34 |
| -post_text = re.findall(regex_text, out_text); |
35 |
| -wait_time1 = 4; |
36 |
| -wait_time2 = wait_time1 + 4; |
37 |
| -i = 0; |
38 |
| -il = len(post_text); |
39 |
| -print("0 Found "+str(il)+" Image Galleries."); |
| 32 | +fakeua = "Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Firefox/24.0"" |
| 33 | +geturls_cj = cookielib.CookieJar() |
| 34 | +geturls_opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(geturls_cj)) |
| 35 | +geturls_opener.addheaders = [("Referer", "http://www.google.com/search?q=younglegalporn"), ("User-Agent", fakeua), ("Accept-Encoding", "gzip, deflate"), ("Accept-Language", "en-US,en-CA,en-GB,en-UK,en-AU,en-NZ,en-ZA,en;q=0.5"), |
| 36 | + ("Accept-Charset", "ISO-8859-1,ISO-8859-15,utf-8;q=0.7,*;q=0.7"), ("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"), ("Connection", "close")] |
| 37 | +print("0 Reading URL: http://photos.younglegalporn.com/") |
| 38 | +geturls_text = geturls_opener.open("http://photos.younglegalporn.com/") |
| 39 | +if(geturls_text.info().get("Content-Encoding") == "gzip" or geturls_text.info().get("Content-Encoding") == "deflate"): |
| 40 | + strbuf = StringIO.StringIO(geturls_text.read()) |
| 41 | + gzstrbuf = gzip.GzipFile(fileobj=strbuf) |
| 42 | + out_text = gzstrbuf.read()[:] |
| 43 | +if(geturls_text.info().get("Content-Encoding") != "gzip" and geturls_text.info().get("Content-Encoding") != "deflate"): |
| 44 | + out_text = geturls_text.read()[:] |
| 45 | +regex_text = re.escape("<li><a href=\"http://photos.younglegalporn.com/") + \ |
| 46 | + "([a-fA-F0-9]{8})"+re.escape("/") + \ |
| 47 | + "([a-zA-Z0-9]{14})"+re.escape("/\"><img title=\"") |
| 48 | +post_text = re.findall(regex_text, out_text) |
| 49 | +wait_time1 = 4 |
| 50 | +wait_time2 = wait_time1 + 4 |
| 51 | +i = 0 |
| 52 | +il = len(post_text) |
| 53 | +print("0 Found "+str(il)+" Image Galleries.") |
40 | 54 | if(not os.path.exists("./younglegalporn/")):
|
41 |
| - print("0 Making Directory: ./younglegalporn/"); |
42 |
| - os.mkdir("./younglegalporn/"); |
| 55 | + print("0 Making Directory: ./younglegalporn/") |
| 56 | + os.mkdir("./younglegalporn/") |
43 | 57 | while(i < il):
|
44 |
| - if(not os.path.exists("./younglegalporn/"+post_text[i][0]+"/")): |
45 |
| - print(str(i+1)+" Making Directory: ./younglegalporn/"+post_text[i][0]+"/"); |
46 |
| - os.mkdir("./younglegalporn/"+post_text[i][0]+"/"); |
47 |
| - getsuburls_cj = geturls_cj; |
48 |
| - getsuburls_opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(getsuburls_cj)); |
49 |
| - getsuburls_opener.addheaders = [("Referer", "http://photos.younglegalporn.com/"), ("User-Agent", fakeua), ("Accept-Encoding", "gzip, deflate"), ("Accept-Language", "en-US,en-CA,en-GB,en-UK,en-AU,en-NZ,en-ZA,en;q=0.5"), ("Accept-Charset", "ISO-8859-1,ISO-8859-15,utf-8;q=0.7,*;q=0.7"), ("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"), ("Connection", "close")]; |
50 |
| - print(str(i+1)+" Start Downloading Image Gallery: "+str(i+1)+" of "+str(il)); |
51 |
| - print(str(i+1)+" Start Downloading Image Gallery: "+post_text[i][0]); |
52 |
| - print(str(i+1)+" Reading Image Gallery: http://photos.younglegalporn.com/"+post_text[i][0]+"/"+post_text[i][1]+"/"); |
53 |
| - getsuburls_text = getsuburls_opener.open("http://photos.younglegalporn.com/"+post_text[i][0]+"/"+post_text[i][1]+"/"); |
54 |
| - if(getsuburls_text.info().get("Content-Encoding")=="gzip" or getsuburls_text.info().get("Content-Encoding")=="deflate"): |
55 |
| - substrbuf = StringIO.StringIO(getsuburls_text.read()); |
56 |
| - gzsubstrbuf = gzip.GzipFile(fileobj=substrbuf); |
57 |
| - subout_text = gzsubstrbuf.read()[:]; |
58 |
| - if(getsuburls_text.info().get("Content-Encoding")!="gzip" and getsuburls_text.info().get("Content-Encoding")!="deflate"): |
59 |
| - subout_text = getsuburls_text.read()[:]; |
60 |
| - subout_text = subout_text.replace("://", ":///"); |
61 |
| - subout_text = subout_text.replace("//", "/"); |
62 |
| - subout_text = subout_text.replace("//pics/", "/pics/"); |
63 |
| - subout_text = subout_text.replace("/pics//", "/pics/"); |
64 |
| - subregex_text = re.escape("<a href=\"http://content1.sexforsure.com/")+"([0-9]+)"+re.escape("/")+"([0-9]+)"+re.escape("/")+"([0-9]+)"+re.escape("/")+"([0-9]+)"+re.escape("/pics/")+"([0-9]+)"+re.escape(".jpg\"><img src=\""); |
65 |
| - subpost_text = re.findall(subregex_text, subout_text); |
66 |
| - if(len(subpost_text)==0): |
67 |
| - subregex_text = re.escape("<a href=\"http://content1.sexforsure.com/")+"([0-9]+)"+re.escape("/")+"([0-9]+)"+re.escape("/")+"([0-9]+)"+re.escape("/")+"([0-9]+)"+re.escape("//pics/")+"([0-9]+)"+re.escape(".jpg\"><img src=\""); |
68 |
| - subpost_text = re.findall(subregex_text, subout_text); |
69 |
| - subi = int(subpost_text[0][4]) - 1; |
70 |
| - subil = int(subpost_text[-1][4]); |
71 |
| - print(str(i+1)+" Found "+subpost_text[-1][4]+" JPEG Images."); |
72 |
| - while(subi < subil): |
73 |
| - getsub2xurls_cj = geturls_cj; |
74 |
| - getsub2xurls_opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(getsub2xurls_cj)); |
75 |
| - getsub2xurls_opener.addheaders = [("Referer", "http://photos.younglegalporn.com/"+post_text[i][0]+"/"+post_text[i][1]+"/"), ("User-Agent", fakeua), ("Accept-Encoding", "gzip, deflate"), ("Accept-Language", "en-US,en-CA,en-GB,en-UK,en-AU,en-NZ,en-ZA,en;q=0.5"), ("Accept-Charset", "ISO-8859-1,ISO-8859-15,utf-8;q=0.7,*;q=0.7"), ("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"), ("Connection", "close")]; |
76 |
| - print(str(i+1)+","+str(subi+1)+" Start Downloading Image File: "+str(subi+1)+" of "+str(subil)); |
77 |
| - print(str(i+1)+","+str(subi+1)+" Downloading Image: http://content1.sexforsure.com/"+subpost_text[subi][0]+"/"+subpost_text[subi][1]+"/"+subpost_text[subi][2]+"/"+subpost_text[subi][3]+"/pics/"+subpost_text[subi][4]+".jpg"); |
78 |
| - getsub2xurls_text = getsub2xurls_opener.open("http://content1.sexforsure.com/"+subpost_text[subi][0]+"/"+subpost_text[subi][1]+"/"+subpost_text[subi][2]+"/"+subpost_text[subi][3]+"/pics/"+subpost_text[subi][4]+".jpg"); |
79 |
| - print(str(i+1)+","+str(subi+1)+" Finished Downloading Image: http://content1.sexforsure.com/"+subpost_text[subi][0]+"/"+subpost_text[subi][1]+"/"+subpost_text[subi][2]+"/"+subpost_text[subi][3]+"/pics/"+subpost_text[subi][4]+".jpg"); |
80 |
| - print(str(i+1)+","+str(subi+1)+" Saving File: ./younglegalporn/"+post_text[i][0]+"/"+subpost_text[subi][4]+".jpg"); |
81 |
| - jpegf = open("./younglegalporn/"+post_text[i][0]+"/"+subpost_text[subi][4]+".jpg", "wb"); |
82 |
| - jpegf.write(getsub2xurls_text.read()); |
83 |
| - jpegf.close(); |
84 |
| - print(str(i+1)+","+str(subi+1)+" Finished Saving File: ./younglegalporn/"+post_text[i][0]+"/"+subpost_text[subi][4]+".jpg"); |
85 |
| - time.sleep(wait_time1); |
86 |
| - subi = subi + 1; |
87 |
| - print(str(i+1)+" Finished Downloading Image Gallery: "+post_text[i][0]); |
88 |
| - time.sleep(wait_time2); |
89 |
| - i = i + 1; |
90 |
| - if(i < il): |
91 |
| - print(str(i+1)+" Next Image Gallery Download: "+post_text[i][0]); |
92 |
| -print("Full Download Completed Successfully"); |
| 58 | + if(not os.path.exists("./younglegalporn/"+post_text[i][0]+"/")): |
| 59 | + print(str(i+1)+" Making Directory: ./younglegalporn/" + |
| 60 | + post_text[i][0]+"/") |
| 61 | + os.mkdir("./younglegalporn/"+post_text[i][0]+"/") |
| 62 | + getsuburls_cj = geturls_cj |
| 63 | + getsuburls_opener = urllib2.build_opener( |
| 64 | + urllib2.HTTPCookieProcessor(getsuburls_cj)) |
| 65 | + getsuburls_opener.addheaders = [("Referer", "http://photos.younglegalporn.com/"), ("User-Agent", fakeua), ("Accept-Encoding", "gzip, deflate"), ("Accept-Language", "en-US,en-CA,en-GB,en-UK,en-AU,en-NZ,en-ZA,en;q=0.5"), |
| 66 | + ("Accept-Charset", "ISO-8859-1,ISO-8859-15,utf-8;q=0.7,*;q=0.7"), ("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"), ("Connection", "close")] |
| 67 | + print(str(i+1)+" Start Downloading Image Gallery: "+str(i+1)+" of "+str(il)) |
| 68 | + print(str(i+1)+" Start Downloading Image Gallery: "+post_text[i][0]) |
| 69 | + print(str(i+1)+" Reading Image Gallery: http://photos.younglegalporn.com/" + |
| 70 | + post_text[i][0]+"/"+post_text[i][1]+"/") |
| 71 | + getsuburls_text = getsuburls_opener.open( |
| 72 | + "http://photos.younglegalporn.com/"+post_text[i][0]+"/"+post_text[i][1]+"/") |
| 73 | + if(getsuburls_text.info().get("Content-Encoding") == "gzip" or getsuburls_text.info().get("Content-Encoding") == "deflate"): |
| 74 | + substrbuf = StringIO.StringIO(getsuburls_text.read()) |
| 75 | + gzsubstrbuf = gzip.GzipFile(fileobj=substrbuf) |
| 76 | + subout_text = gzsubstrbuf.read()[:] |
| 77 | + if(getsuburls_text.info().get("Content-Encoding") != "gzip" and getsuburls_text.info().get("Content-Encoding") != "deflate"): |
| 78 | + subout_text = getsuburls_text.read()[:] |
| 79 | + subout_text = subout_text.replace("://", ":///") |
| 80 | + subout_text = subout_text.replace("//", "/") |
| 81 | + subout_text = subout_text.replace("//pics/", "/pics/") |
| 82 | + subout_text = subout_text.replace("/pics//", "/pics/") |
| 83 | + subregex_text = re.escape("<a href=\"http://content1.sexforsure.com/")+"([0-9]+)"+re.escape("/")+"([0-9]+)"+re.escape( |
| 84 | + "/")+"([0-9]+)"+re.escape("/")+"([0-9]+)"+re.escape("/pics/")+"([0-9]+)"+re.escape(".jpg\"><img src=\"") |
| 85 | + subpost_text = re.findall(subregex_text, subout_text) |
| 86 | + if(len(subpost_text) == 0): |
| 87 | + subregex_text = re.escape("<a href=\"http://content1.sexforsure.com/")+"([0-9]+)"+re.escape("/")+"([0-9]+)"+re.escape( |
| 88 | + "/")+"([0-9]+)"+re.escape("/")+"([0-9]+)"+re.escape("//pics/")+"([0-9]+)"+re.escape(".jpg\"><img src=\"") |
| 89 | + subpost_text = re.findall(subregex_text, subout_text) |
| 90 | + subi = int(subpost_text[0][4]) - 1 |
| 91 | + subil = int(subpost_text[-1][4]) |
| 92 | + print(str(i+1)+" Found "+subpost_text[-1][4]+" JPEG Images.") |
| 93 | + while(subi < subil): |
| 94 | + getsub2xurls_cj = geturls_cj |
| 95 | + getsub2xurls_opener = urllib2.build_opener( |
| 96 | + urllib2.HTTPCookieProcessor(getsub2xurls_cj)) |
| 97 | + getsub2xurls_opener.addheaders = [("Referer", "http://photos.younglegalporn.com/"+post_text[i][0]+"/"+post_text[i][1]+"/"), ("User-Agent", fakeua), ("Accept-Encoding", "gzip, deflate"), ("Accept-Language", |
| 98 | + "en-US,en-CA,en-GB,en-UK,en-AU,en-NZ,en-ZA,en;q=0.5"), ("Accept-Charset", "ISO-8859-1,ISO-8859-15,utf-8;q=0.7,*;q=0.7"), ("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"), ("Connection", "close")] |
| 99 | + print(str(i+1)+","+str(subi+1) + |
| 100 | + " Start Downloading Image File: "+str(subi+1)+" of "+str(subil)) |
| 101 | + print(str(i+1)+","+str(subi+1)+" Downloading Image: http://content1.sexforsure.com/" + |
| 102 | + subpost_text[subi][0]+"/"+subpost_text[subi][1]+"/"+subpost_text[subi][2]+"/"+subpost_text[subi][3]+"/pics/"+subpost_text[subi][4]+".jpg") |
| 103 | + getsub2xurls_text = getsub2xurls_opener.open( |
| 104 | + "http://content1.sexforsure.com/"+subpost_text[subi][0]+"/"+subpost_text[subi][1]+"/"+subpost_text[subi][2]+"/"+subpost_text[subi][3]+"/pics/"+subpost_text[subi][4]+".jpg") |
| 105 | + print(str(i+1)+","+str(subi+1)+" Finished Downloading Image: http://content1.sexforsure.com/" + |
| 106 | + subpost_text[subi][0]+"/"+subpost_text[subi][1]+"/"+subpost_text[subi][2]+"/"+subpost_text[subi][3]+"/pics/"+subpost_text[subi][4]+".jpg") |
| 107 | + print(str(i+1)+","+str(subi+1)+" Saving File: ./younglegalporn/" + |
| 108 | + post_text[i][0]+"/"+subpost_text[subi][4]+".jpg") |
| 109 | + jpegf = open("./younglegalporn/" + |
| 110 | + post_text[i][0]+"/"+subpost_text[subi][4]+".jpg", "wb") |
| 111 | + jpegf.write(getsub2xurls_text.read()) |
| 112 | + jpegf.close() |
| 113 | + print(str(i+1)+","+str(subi+1)+" Finished Saving File: ./younglegalporn/" + |
| 114 | + post_text[i][0]+"/"+subpost_text[subi][4]+".jpg") |
| 115 | + time.sleep(wait_time1) |
| 116 | + subi = subi + 1 |
| 117 | + print(str(i+1)+" Finished Downloading Image Gallery: "+post_text[i][0]) |
| 118 | + time.sleep(wait_time2) |
| 119 | + i = i + 1 |
| 120 | + if(i < il): |
| 121 | + print(str(i+1)+" Next Image Gallery Download: "+post_text[i][0]) |
| 122 | +print("Full Download Completed Successfully") |
0 commit comments