4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the Revised BSD License.
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 Revised BSD License for more details.
12 Copyright 2016 Cool Dude 2k - http://idb.berlios.de/
13 Copyright 2016 Game Maker 2k - http://intdb.sourceforge.net/
14 Copyright 2016 Kazuki Przyborowski - https://github.com/KazukiPrzyborowski
16 $FileInfo: pymotherless.py - Last Update: 1/19/2016 Ver. 0.2.8 RC 1 - Author: cooldude2k $
19 from __future__
import division
, absolute_import
, print_function
;
20 import re
, os
, sys
, urllib
, gzip
, time
, datetime
, argparse
, cgi
, subprocess
;
21 if(sys
.version
[0]=="2"):
23 from cStringIO
import StringIO
;
25 from StringIO
import StringIO
;
26 import urllib2
, urlparse
, cookielib
;
27 if(sys
.version
[0]=="3"):
28 from io
import StringIO
, BytesIO
;
29 import urllib
.request
as urllib2
;
30 import urllib
.parse
as urlparse
;
31 import http
.cookiejar
as cookielib
;
32 #if(__name__ == "__main__"):
33 sys
.tracebacklimit
= 0;
34 __program_name__
= "PyMotherless";
35 __version_info__
= (0, 2, 8, "RC 1");
36 __version_date__
= "2016.01.19";
37 if(__version_info__
[3]!=None):
38 __version__
= str(__version_info__
[0])+"."+str(__version_info__
[1])+"."+str(__version_info__
[2])+" "+str(__version_info__
[3]);
39 if(__version_info__
[3]==None):
40 __version__
= str(__version_info__
[0])+"."+str(__version_info__
[1])+"."+str(__version_info__
[2]);
42 geturls_cj
= cookielib
.CookieJar();
43 geturls_ua_firefox_windows7
= "Mozilla/5.0 (Windows NT 6.1; rv:43.0) Gecko/20100101 Firefox/43.0";
44 geturls_ua_chrome_windows7
= "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36";
45 geturls_ua_internet_explorer_windows7
= "Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko";
46 geturls_ua
= geturls_ua_firefox_windows7
;
47 geturls_headers
= [("Referer", "http://motherless.com/"), ("User-Agent", geturls_ua
), ("Accept-Encoding", "gzip, deflate"), ("Accept-Language", "en-US,en;q=0.8,en-CA,en-GB;q=0.6"), ("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")];
48 geturls_download_sleep
= 0;
50 def add_url_param(url
, **params
):
52 parts
= list(urlparse
.urlsplit(url
));
53 d
= dict(cgi
.parse_qsl(parts
[n
])); # use cgi.parse_qs for list values
55 parts
[n
]=urllib
.urlencode(d
);
56 return urlparse
.urlunsplit(parts
);
58 os
.environ
["PATH"] = os
.environ
["PATH"] + os
.pathsep
+ os
.path
.dirname(os
.path
.realpath(__file__
)) + os
.pathsep
+ os
.getcwd();
59 def which_exec(execfile):
60 for path
in os
.environ
["PATH"].split(":"):
61 if os
.path
.exists(path
+ "/" + execfile):
62 return path
+ "/" + execfile;
72 newlistreg
.update({ilx
: varlist
[il
]});
73 newlistrev
.update({varlist
[il
]: ilx
});
76 newlistfull
= {1: newlistreg
, 2: newlistrev
, 'reg': newlistreg
, 'rev': newlistrev
};
79 def twolistize(varlist
):
89 newlistnamereg
.update({ilx
: varlist
[il
][0].strip()});
90 newlistnamerev
.update({varlist
[il
][0].strip(): ilx
});
91 newlistdescreg
.update({ilx
: varlist
[il
][1].strip()});
92 newlistdescrev
.update({varlist
[il
][1].strip(): ilx
});
95 newlistnametmp
= {1: newlistnamereg
, 2: newlistnamerev
, 'reg': newlistnamereg
, 'rev': newlistnamerev
};
96 newlistdesctmp
= {1: newlistdescreg
, 2: newlistdescrev
, 'reg': newlistdescreg
, 'rev': newlistdescrev
};
97 newlistfull
= {1: newlistnametmp
, 2: newlistdesctmp
, 'name': newlistnametmp
, 'desc': newlistdesctmp
}
100 def arglistize(proexec
, *varlist
):
104 newarglist
= [proexec
];
106 if varlist
[il
][0] is not None:
107 newarglist
.append(varlist
[il
][0]);
108 if varlist
[il
][1] is not None:
109 newarglist
.append(varlist
[il
][1]);
113 def make_http_headers_from_dict(headers
={'Referer': "http://motherless.com/", 'User-Agent': geturls_ua
, 'Accept-Encoding': "gzip, deflate", 'Accept-Language': "en-US,en;q=0.8,en-CA,en-GB;q=0.6", '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"}):
115 for headkey
, headvalue
in headers
.iteritems():
116 returnval
.append((headkey
, headvalue
));
119 def download_from_url(httpurl
, httpheaders
, httpcookie
, sleep
=-1):
120 global geturls_download_sleep
;
122 sleep
= geturls_download_sleep
;
123 geturls_opener
= urllib2
.build_opener(urllib2
.HTTPCookieProcessor(httpcookie
));
124 geturls_opener
.addheaders
= httpheaders
;
126 geturls_text
= geturls_opener
.open(httpurl
);
127 if(geturls_text
.info().get("Content-Encoding")=="gzip" or geturls_text
.info().get("Content-Encoding")=="deflate"):
128 if(sys
.version
[0]=="2"):
129 strbuf
= StringIO(geturls_text
.read());
130 if(sys
.version
[0]=="3"):
131 strbuf
= BytesIO(geturls_text
.read());
132 gzstrbuf
= gzip
.GzipFile(fileobj
=strbuf
);
133 if(sys
.version
[0]=="2"):
134 returnval
= gzstrbuf
.read()[:];
135 if(sys
.version
[0]=="3"):
136 returnval
= gzstrbuf
.read()[:].decode('ascii', 'replace');
137 if(geturls_text
.info().get("Content-Encoding")!="gzip" and geturls_text
.info().get("Content-Encoding")!="deflate"):
138 returnval
= geturls_text
.read()[:];
141 def download_from_url_file(httpurl
, httpheaders
, httpcookie
, sleep
=-1):
142 global geturls_download_sleep
;
144 sleep
= geturls_download_sleep
;
145 geturls_opener
= urllib2
.build_opener(urllib2
.HTTPCookieProcessor(httpcookie
));
146 geturls_opener
.addheaders
= httpheaders
;
148 geturls_text
= geturls_opener
.open(httpurl
);
149 if(geturls_text
.info().get("Content-Encoding")=="gzip" or geturls_text
.info().get("Content-Encoding")=="deflate"):
150 if(sys
.version
[0]=="2"):
151 strbuf
= StringIO(geturls_text
.read());
152 if(sys
.version
[0]=="3"):
153 strbuf
= BytesIO(geturls_text
.read());
154 gzstrbuf
= gzip
.GzipFile(fileobj
=strbuf
);
155 returnval
= gzstrbuf
.read()[:];
156 if(geturls_text
.info().get("Content-Encoding")!="gzip" and geturls_text
.info().get("Content-Encoding")!="deflate"):
157 returnval
= geturls_text
.read()[:];
160 def download_from_url_to_file(httpurl
, httpheaders
, httpcookie
, outfile
="-", outpath
=os
.getcwd(), sleep
=-1):
161 global geturls_download_sleep
;
163 sleep
= geturls_download_sleep
;
164 if(not outfile
=="-"):
165 outpath
= outpath
.rstrip(os
.path
.sep
);
166 filepath
= os
.path
.realpath(outpath
+os
.path
.sep
+outfile
);
167 if(not os
.path
.exists(outpath
)):
168 os
.makedirs(outpath
);
169 if(os
.path
.exists(outpath
) and os
.path
.isfile(outpath
)):
171 if(os
.path
.exists(filepath
) and os
.path
.isdir(filepath
)):
173 with
open(filepath
, 'wb+') as f
:
174 f
.write(download_from_url_file(httpurl
, httpheaders
, httpcookie
, sleep
));
177 if(outfile
=="-" and sys
.version
[0]=="2"):
179 f
.write(download_from_url_file(httpurl
, httpheaders
, httpcookie
, sleep
));
180 returnval
= f
.getvalue();
182 if(outfile
=="-" and sys
.version
[0]=="3"):
184 f
.write(download_from_url_file(httpurl
, httpheaders
, httpcookie
, sleep
));
185 returnval
= f
.getvalue();
189 def get_motherless_get_number_pages(httpurl
, httpheaders
, httpcookie
):
190 mrtext
= download_from_url(httpurl
, httpheaders
, httpcookie
);
191 mregex_getpagenum
= re
.escape("page=")+"([0-9]+)"+re
.escape("\" class=\"pop\" rel=\"")+"([0-9]+)"+re
.escape("\">")+"([0-9]+)"+re
.escape("</a>");
192 mlesspagenum
= re
.findall(mregex_getpagenum
, mrtext
);
194 returnval
= mlesspagenum
[-1][0];
199 def get_motherless_get_link_type(httpurl
):
200 mlessvidqstr
= urlparse
.parse_qs(urlparse
.urlparse(httpurl
).query
);
201 mlessvidid_parts
= urlparse
.urlparse(httpurl
);
202 mlessvidid
= mlessvidid_parts
.path
.split("/");
204 if(mlessvidid
[1]=="videos" and len(mlessvidid
)==3 and (mlessvidid
[2]=="recent" or mlessvidid
[2]=="favorited" or mlessvidid
[2]=="viewed" or mlessvidid
[2]=="commented" or mlessvidid
[2]=="popular")):
205 returnval
= "gallery";
206 if(mlessvidid
[1]=="images" and len(mlessvidid
)==3 and (mlessvidid
[2]=="recent" or mlessvidid
[2]=="favorited" or mlessvidid
[2]=="viewed" or mlessvidid
[2]=="commented" or mlessvidid
[2]=="popular")):
207 returnval
= "gallery";
208 if(mlessvidid
[1]=="galleries" and len(mlessvidid
)==3 and (mlessvidid
[2]=="recent" or mlessvidid
[2]=="favorited" or mlessvidid
[2]=="viewed" or mlessvidid
[2]=="commented" or mlessvidid
[2]=="popular")):
209 returnval
= "gallery";
210 if(mlessvidid
[1]=="videos" and len(mlessvidid
)==2):
211 returnval
= "sample-videos";
212 if(mlessvidid
[1]=="images" and len(mlessvidid
)==2):
213 returnval
= "sample-images";
214 if(mlessvidid
[1]=="galleries" and len(mlessvidid
)==2):
215 returnval
= "sample-galleries";
216 if(mlessvidid
[1]=="" and len(mlessvidid
)==2):
217 returnval
= "sample";
218 if(mlessvidid
[1]=="live" and len(mlessvidid
)==3 and (mlessvidid
[2]=="videos" or mlessvidid
[2]=="images")):
219 returnval
= "gallery";
220 if(mlessvidid
[1]=="u" and len(mlessvidid
)==3):
221 returnval
= "gallery";
222 if(mlessvidid
[1]=="f" and len(mlessvidid
)==4 and (mlessvidid
[2]=="videos" or mlessvidid
[2]=="images" or mlessvidid
[2]=="galleries")):
223 returnval
= "gallery";
224 if(mlessvidid
[1]=="galleries" and len(mlessvidid
)==4 and mlessvidid
[2]=="member"):
225 returnval
= "gallery";
226 if(mlessvidid
[1]=="galleries" and len(mlessvidid
)==5 and mlessvidid
[2]=="member" and (mlessvidid
[4]=="created" or mlessvidid
[4]=="viewed" or mlessvidid
[4]=="favorited" or mlessvidid
[4]=="commented")):
227 returnval
= "gallery";
228 if(mlessvidid
[1]=="gv" and len(mlessvidid
)==3):
229 returnval
= "gallery";
230 if(mlessvidid
[1]=="gi" and len(mlessvidid
)==3):
231 returnval
= "gallery";
232 if(mlessvidid
[1]=="term" and len(mlessvidid
)==3 and (mlessvidid
[2]=="videos" or mlessvidid
[2]=="images" or mlessvidid
[2]=="galleries")):
233 returnval
= "gallery";
234 if(mlessvidid
[1]=="g" and len(mlessvidid
)==4):
236 if(mlessvidid
[1]=="random" and len(mlessvidid
)==3 and (mlessvidid
[2]=="video" or mlessvidid
[2]=="image")):
238 if(re
.match("^V", mlessvidid
[1]) and len(mlessvidid
)==2):
240 if(mlessvidid
[1]=="members" and len(mlessvidid
)==2):
241 returnval
= "member";
242 if(mlessvidid
[1]=="members" and mlessvidid
[2]=="search" and len(mlessvidid
)==3):
243 returnval
= "member";
244 if(mlessvidid
[1]=="members" and len(mlessvidid
)==4 and (mlessvidid
[2]=="uploader" or mlessvidid
[2]=="viewed" or mlessvidid
[2]=="social" or mlessvidid
[2]=="favorited" or mlessvidid
[2]=="commented" or mlessvidid
[2]=="mentioned" or mlessvidid
[2]=="verified")):
245 returnval
= "member";
246 if(mlessvidid
[1]=="girls" and len(mlessvidid
)==2):
248 if(mlessvidid_parts
.netloc
=="cdn.images.motherlessmedia.com" or mlessvidid_parts
.netloc
=="cdn.videos.motherlessmedia.com" or mlessvidid_parts
.netloc
=="cdn.thumbs.motherlessmedia.com"):
249 returnval
= "download";
250 if(returnval
==False and len(mlessvidid
)==2):
254 def get_motherless_links(httpurl
, httpheaders
, httpcookie
):
255 mrtext
= download_from_url(httpurl
, httpheaders
, httpcookie
);
256 mregex_gettitle
= re
.escape("<title>")+"(.*)"+re
.escape(" - MOTHERLESS.COM</title>");
257 mlesstitle
= re
.findall(mregex_gettitle
, mrtext
);
258 mregex_geturlone
= re
.escape("__fileurl = 'http://cdn.")+"(images|videos)"+re
.escape(".motherlessmedia.com/")+"(images|videos)"+re
.escape("/")+"([\w\/\?\&\=\.\-]+)"+re
.escape("';");
259 mlesslinkone
= re
.findall(mregex_geturlone
, mrtext
);
260 mregex_geturltwo
= re
.escape("<meta property=\"og:image\" content=\"http://cdn.")+"(images|thumbs)"+re
.escape(".motherlessmedia.com/")+"(images|thumbs)"+re
.escape("/")+"([\w\/\?\&\=\.\-]+)"+re
.escape("\">");
261 mlesslinktwo
= re
.findall(mregex_geturltwo
, mrtext
);
262 filenameext
= os
.path
.basename(urlparse
.urljoin("http://cdn."+mlesslinkone
[0][0]+".motherlessmedia.com/"+mlesslinkone
[0][1]+"/"+mlesslinkone
[0][2], urlparse
.urlparse("http://cdn."+mlesslinkone
[0][0]+".motherlessmedia.com/"+mlesslinkone
[0][1]+"/"+mlesslinkone
[0][2]).path
));
263 filename
, fileextension
= os
.path
.splitext(filenameext
);
264 thumbfilenameext
= os
.path
.basename(urlparse
.urljoin("http://cdn.images.motherlessmedia.com/"+mlesslinktwo
[0][1]+"/"+mlesslinktwo
[0][2], urlparse
.urlparse("http://cdn.images.motherlessmedia.com/"+mlesslinktwo
[0][1]+"/"+mlesslinktwo
[0][2]).path
));
265 thumbfilename
, thumbfileextension
= os
.path
.splitext(thumbfilenameext
);
266 mregex_getuname
= re
.escape("<tr rel=\"")+"([\w\/\?\&\=\.\-]+)"+re
.escape("\"");
267 mlessuname
= re
.findall(mregex_getuname
, mrtext
);
268 mlessuname
= mlessuname
[0];
269 mregex_geturlname
= re
.escape("<a href=\"/m/")+"([\w\/\?\&\=\.\-]+)"+re
.escape("\" target=\"_blank\">\n <img");
270 mlessurlname
= re
.findall(mregex_geturlname
, mrtext
);
271 mlessurlname
= mlessurlname
[0];
272 mregex_getavatar
= re
.escape("<img\n src=\"")+"(.*)"+re
.escape("\"\n class=\"avatar avatar-small\"");
273 mlessavatar
= re
.findall(mregex_getavatar
, mrtext
);
274 mlessavatar
= mlessavatar
[0];
275 avatarfilenameext
= os
.path
.basename(urlparse
.urljoin(mlessavatar
, urlparse
.urlparse(mlessavatar
).path
));
276 avatarfilename
, avatarfileextension
= os
.path
.splitext(avatarfilenameext
);
277 if(mlesslinkone
[0][1]=="images"):
278 thumbnailaltpart
= thumbfilename
+"-zoom"+thumbfileextension
;
279 thumbnailalt
= "http://cdn.thumbs.motherlessmedia.com/thumbs/"+thumbnailaltpart
;
280 thumbnailaltfilenameext
= os
.path
.basename(urlparse
.urljoin(thumbnailalt
, urlparse
.urlparse(thumbnailalt
).path
));
281 thumbnailaltfilename
, thumbnailaltfileextension
= os
.path
.splitext(thumbnailaltfilenameext
);
282 if(mlesslinkone
[0][1]=="videos"):
283 thumbnailaltpart
= +thumbfilename
+"-small"+thumbfileextension
;
284 thumbnailalt
= "http://cdn.thumbs.motherlessmedia.com/thumbs/"+thumbnailaltpart
;
285 thumbnailaltfilenameext
= os
.path
.basename(urlparse
.urljoin(thumbnailalt
, urlparse
.urlparse(thumbnailalt
).path
));
286 thumbnailaltfilename
, thumbnailaltfileextension
= os
.path
.splitext(thumbnailaltfilenameext
);
288 mlessurltype
= get_motherless_get_link_type("http://cdn."+mlesslinkone
[0][0]+".motherlessmedia.com/"+mlesslinkone
[0][1]+"/"+mlesslinkone
[0][2]);
289 if(mlesslinkone
[0][1]=="images"):
290 returnval
= {'type': mlesslinkone
[0][1], 'urltype': mlessurltype
, 'url': "http://cdn."+mlesslinkone
[0][0]+".motherlessmedia.com/"+mlesslinkone
[0][1]+"/"+mlesslinkone
[0][2], 'orginurl': httpurl
, 'orginurltype': get_motherless_get_link_type(httpurl
), 'thumbnail': "http://cdn.thumbs.motherlessmedia.com/thumbs/"+mlesslinktwo
[0][2], 'thumbnailalt': thumbnailalt
+"?from_helper", 'title': mlesstitle
[0], 'fullfilename': filenameext
, 'filename': filename
, 'extension': fileextension
, 'thumbfullfilename': thumbfilenameext
, 'thumbfilename': thumbfilename
, 'thumbextension': thumbfileextension
, 'thumbnailaltfullfilename': thumbnailaltpart
, 'thumbnailaltfilename': thumbnailaltfilename
, 'thumbnailaltextension': thumbnailaltfileextension
, 'username': mlessuname
, 'avatarurl': mlessavatar
, 'avatarfullfilename': avatarfilenameext
, 'avatarfilename': avatarfilename
, 'avatarextension': avatarfileextension
};
291 if(mlesslinkone
[0][1]=="videos"):
292 returnval
= {'type': mlesslinkone
[0][1], 'url': "http://cdn."+mlesslinkone
[0][0]+".motherlessmedia.com/"+mlesslinkone
[0][1]+"/"+mlesslinkone
[0][2], 'orginurl': httpurl
, 'orginurltype': get_motherless_get_link_type(httpurl
), 'thumbnail': "http://cdn.thumbs.motherlessmedia.com/"+mlesslinktwo
[0][1]+"/"+mlesslinktwo
[0][2], 'thumbnailalt': thumbnailalt
+"?from_helper", 'title': mlesstitle
[0], 'fullfilename': filenameext
, 'filename': filename
, 'extension': fileextension
, 'thumbfullfilename': thumbfilenameext
, 'thumbfilename': thumbfilename
, 'thumbextension': thumbfileextension
, 'thumbnailaltfullfilename': thumbnailaltpart
, 'thumbnailaltfilename': thumbnailaltfilename
, 'thumbnailaltextension': thumbnailaltfileextension
, 'username': mlessuname
, 'avatarurl': mlessavatar
, 'avatarfullfilename': avatarfilenameext
, 'avatarfilename': avatarfilename
, 'avatarextension': avatarfileextension
};
295 def get_motherless_galleries_links(httpurl
, httpheaders
, httpcookie
, page
=1, getlinks
=[0, -1]):
296 mrtext
= download_from_url(httpurl
, httpheaders
, httpcookie
);
297 mregex_getpagenum
= re
.escape("page=")+"([0-9]+)"+re
.escape("\" class=\"pop\" rel=\"")+"([0-9]+)"+re
.escape("\">")+"([0-9]+)"+re
.escape("</a>");
298 mlesspagenum
= re
.findall(mregex_getpagenum
, mrtext
);
300 lastpage
= mlesspagenum
[-1][0];
305 httpurl
= add_url_param(httpurl
, page
=str(page
));
306 mrtext
= download_from_url(httpurl
, httpheaders
, httpcookie
);
307 mregex_geturlone
= re
.escape("<a href=\"/")+"([\w\/]+)"+re
.escape("\" class=\"img-container\" target=\"_self\">");
308 mrtext_tmp
= re
.sub(re
.escape("http://motherless.com"), "", mrtext
);
309 mrtext_tmp
= re
.sub(re
.escape("http://www.motherless.com"), "", mrtext_tmp
);
310 mrtext_tmp
= re
.sub(re
.escape("http://motherless.com"), "", mrtext_tmp
);
311 mrtext_tmp
= re
.sub(re
.escape("http://www.motherless.com"), "", mrtext_tmp
);
312 mlesslinkone
= re
.findall(mregex_geturlone
, mrtext_tmp
);
313 mregex_geturltwo
= re
.escape("<img class=\"static\" src=\"http://cdn.thumbs.motherlessmedia.com/")+"([\w\/\?\&\=\.\-]+)"+re
.escape("\" data-strip-src=\"http://cdn.thumbs.motherlessmedia.com/")+"([\w\/\?\&\=\.\-]+)"+re
.escape("\" alt=\"")+"(.*)"+re
.escape("\" />");
314 mlesslinktwo
= re
.findall(mregex_geturltwo
, mrtext
);
315 mregex_getuserinfo
= re
.escape("<a class=\"caption left\" href=\"/m/")+"([\w\/\?\&\=\.\-]+)"+re
.escape("\">");
316 mlessuname
= re
.findall(mregex_getuserinfo
, mrtext
);
317 if(getlinks
[1]>len(mlesslinkone
) or getlinks
[1]==-1):
318 getlinks
[1] = len(mlesslinkone
);
319 if(getlinks
[0]>getlinks
[1] and not getlinks
[1]==-1):
320 tmpgetlinks0
= getlinks
[0];
321 tmpgetlinks1
= getlinks
[1];
322 getlinks
[0] = tmpgetlinks1
;
323 getlinks
[1] = tmpgetlinks0
;
328 returnval
= {'pages': lastpage
};
329 returnval
.update({'curpage': page
});
330 returnval
.update({'numoflinks': mlil
});
331 returnval
.update({'numofalllinks': len(mlesslinkone
)});
332 returnval
.update({'orginurl': httpurl
});
333 returnval
.update({'orginurltype': get_motherless_get_link_type(httpurl
)});
334 mlessrooturltype
= get_motherless_get_link_type(httpurl
);
335 returnval
.update({'urltype': mlessrooturltype
});
337 stripfilenameext
= os
.path
.basename(urlparse
.urljoin("http://cdn.thumbs.motherlessmedia.com/"+mlesslinktwo
[mli
][1], urlparse
.urlparse("http://cdn.thumbs.motherlessmedia.com/"+mlesslinktwo
[mli
][1]).path
));
338 stripfilename
, stripfileextension
= os
.path
.splitext(stripfilenameext
);
339 thumbfilenameext
= os
.path
.basename(urlparse
.urljoin("http://cdn.thumbs.motherlessmedia.com/"+mlesslinktwo
[mli
][0], urlparse
.urlparse("http://cdn.thumbs.motherlessmedia.com/"+mlesslinktwo
[mli
][0]).path
));
340 thumbfilename
, thumbfileextension
= os
.path
.splitext(thumbfilenameext
);
341 mlessurltype
= get_motherless_get_link_type("http://motherless.com/"+mlesslinkone
[mli
]);
342 returnval
.update({mli
: {'urltype': mlessurltype
, 'url': "http://motherless.com/"+mlesslinkone
[mli
], 'thumbnail': "http://cdn.thumbs.motherlessmedia.com/"+mlesslinktwo
[mli
][0], 'strip': "http://cdn.thumbs.motherlessmedia.com/"+mlesslinktwo
[mli
][1], 'title': mlesslinktwo
[mli
][2], 'thumbfullfilename': thumbfilenameext
, 'thumbfilename': thumbfilename
, 'thumbextension': thumbfileextension
, 'stripfullfilename': stripfilenameext
, 'stripfilename': stripfilename
, 'stripextension': stripfileextension
, 'username': mlessuname
[mli
]} });
346 def get_motherless_random_links(httpheaders
, httpcookie
, linktype
, getlinks
=[0, 80]):
347 if(getlinks
[0]>getlinks
[1] and not getlinks
[1]==-1):
348 tmpgetlinks0
= getlinks
[0];
349 tmpgetlinks1
= getlinks
[1];
350 getlinks
[0] = tmpgetlinks1
;
351 getlinks
[1] = tmpgetlinks0
;
356 if(linktype
=="image"):
357 returnval
= {'pages': 1};
358 returnval
.update({'curpage': 1});
359 returnval
.update({'numoflinks': 80});
360 returnval
.update({'numofalllinks': mlil
});
361 returnval
.update({'orginurl': "http://motherless.com/random/image"});
362 returnval
.update({'orginurltype': "gallery"});
363 returnval
.update({'urltype': "gallery"});
365 get_links
= get_motherless_links("http://motherless.com/random/image", httpheaders
, httpcookie
);
366 returnval
.update({mli
: {'urltype': get_motherless_get_link_type("http://motherless.com/"+get_links
['filename']), 'url': "http://motherless.com/"+get_links
['filename'], 'thumbnail': get_links
['thumbnail'], 'strip': get_links
['thumbnailalt'], 'title': get_links
['title'], 'thumbfullfilename': get_links
['thumbfullfilename'], 'thumbfilename': get_links
['thumbfilename'], 'thumbextension': get_links
['thumbextension'], 'stripfullfilename': get_links
['thumbnailaltfullfilename'], 'stripfilename': get_links
['thumbnailaltextension'], 'stripextension': get_links
['thumbnailaltfilename'], 'username': get_links
['username']} });
368 if(linktype
=="video"):
369 returnval
= {'pages': 1};
370 returnval
.update({'curpage': 1});
371 returnval
.update({'numoflinks': 80});
372 returnval
.update({'numofalllinks': mlil
});
373 returnval
.update({'orginurl': "http://motherless.com/random/video"});
374 returnval
.update({'orginurltype': "gallery"});
375 returnval
.update({'urltype': "gallery"});
377 get_links
= get_motherless_links("http://motherless.com/random/video", httpheaders
, httpcookie
);
378 returnval
.update({mli
: {'urltype': get_motherless_get_link_type("http://motherless.com/"+get_links
['filename']), 'url': "http://motherless.com/"+get_links
['filename'], 'thumbnail': get_links
['thumbnail'], 'strip': get_links
['thumbnailalt'], 'title': get_links
['title'], 'thumbfullfilename': get_links
['thumbfullfilename'], 'thumbfilename': get_links
['thumbfilename'], 'thumbextension': get_links
['thumbextension'], 'stripfullfilename': get_links
['thumbnailaltfullfilename'], 'stripfilename': get_links
['thumbnailaltextension'], 'stripextension': get_links
['thumbnailaltfilename'], 'username': get_links
['username']} });
382 def get_motherless_boards_links(httpurl
, httpheaders
, httpcookie
, getlinks
=[0, -1]):
383 mrtext
= download_from_url(httpurl
, httpheaders
, httpcookie
);
384 mregex_geturlone
= re
.escape("<a href=\"/")+"([\w\/]+)"+re
.escape("\" title=\"motherless link\">");
385 mrtext_tmp
= re
.sub(re
.escape("http://motherless.com"), "", mrtext
);
386 mrtext_tmp
= re
.sub(re
.escape("http://www.motherless.com"), "", mrtext_tmp
);
387 mrtext_tmp
= re
.sub(re
.escape("http://motherless.com"), "", mrtext_tmp
);
388 mrtext_tmp
= re
.sub(re
.escape("http://www.motherless.com"), "", mrtext_tmp
);
389 mlesslinkone
= re
.findall(mregex_geturlone
, mrtext_tmp
);
390 if(getlinks
[1]>len(mlesslinkone
) or getlinks
[1]==-1):
391 getlinks
[1] = len(mlesslinkone
);
392 if(getlinks
[0]>getlinks
[1] and not getlinks
[1]==-1):
393 tmpgetlinks0
= getlinks
[0];
394 tmpgetlinks1
= getlinks
[1];
395 getlinks
[0] = tmpgetlinks1
;
396 getlinks
[1] = tmpgetlinks0
;
401 returnval
= {'numoflinks': mlil
};
402 returnval
.update({'numofalllinks': len(mlesslinkone
)});
403 returnval
.update({'orginurl': httpurl
});
404 returnval
.update({'orginurltype': get_motherless_get_link_type(httpurl
)});
405 mlessrooturltype
= get_motherless_get_link_type(httpurl
);
406 returnval
.update({'urltype': mlessrooturltype
});
408 mlessurltype
= get_motherless_get_link_type("http://motherless.com/"+mlesslinkone
[mli
]);
409 returnval
.update({mli
: {'urltype': mlessurltype
, 'url': "http://motherless.com/"+mlesslinkone
[mli
]} });
413 def get_motherless_search_members(httpurl
, httpheaders
, httpcookie
, page
=1, getlinks
=[0, -1]):
414 mrtext
= download_from_url(httpurl
, httpheaders
, httpcookie
);
415 mregex_getpagenum
= re
.escape("page=")+"([0-9]+)"+re
.escape("\" class=\"pop\" rel=\"")+"([0-9]+)"+re
.escape("\">")+"([0-9]+)"+re
.escape("</a>");
416 mlesspagenum
= re
.findall(mregex_getpagenum
, mrtext
);
418 lastpage
= mlesspagenum
[-1][0];
423 httpurl
= add_url_param(httpurl
, page
=str(page
));
424 mrtext
= download_from_url(httpurl
, httpheaders
, httpcookie
);
425 mregex_getuname
= re
.escape("<tr rel=\"")+"([\w\/\?\&\=\.\-]+)"+re
.escape("\"");
426 mlessuname
= re
.findall(mregex_getuname
, mrtext
);
427 mregex_geturlname
= re
.escape("<a href=\"/m/")+"([\w\/\?\&\=\.\-]+)"+re
.escape("\" target=\"_blank\">\n <img");
428 mlessurlname
= re
.findall(mregex_geturlname
, mrtext
);
429 mregex_getavatar
= re
.escape("<img\n src=\"")+"(.*)"+re
.escape("\"\n class=\"avatar avatar-small\"");
430 mlessavatar
= re
.findall(mregex_getavatar
, mrtext
);
431 if(getlinks
[1]>len(mlesslinkone
) or getlinks
[1]==-1):
432 getlinks
[1] = len(mlesslinkone
);
433 if(getlinks
[0]>getlinks
[1] and not getlinks
[1]==-1):
434 tmpgetlinks0
= getlinks
[0];
435 tmpgetlinks1
= getlinks
[1];
436 getlinks
[0] = tmpgetlinks1
;
437 getlinks
[1] = tmpgetlinks0
;
442 returnval
= {'numoflinks': mlil
};
443 returnval
.update({'numofalllinks': len(mlessuname
)});
444 returnval
.update({'pages': lastpage
});
445 returnval
.update({'curpage': page
});
446 returnval
.update({'orginurl': httpurl
});
447 returnval
.update({'orginurltype': get_motherless_get_link_type(httpurl
)});
448 mlessrooturltype
= get_motherless_get_link_type(httpurl
);
449 returnval
.update({'urltype': mlessrooturltype
});
451 avatarfilenameext
= os
.path
.basename(urlparse
.urljoin(mlessavatar
[mli
], urlparse
.urlparse(mlessavatar
[mli
]).path
));
452 avatarfilename
, avatarfileextension
= os
.path
.splitext(avatarfilenameext
);
453 mlessurltype
= get_motherless_get_link_type("http://motherless.com/"+mlessurlname
[mli
]);
454 returnval
.update({mli
: {'urltype': mlessurltype
, 'url': "http://motherless.com/"+mlessurlname
[mli
], 'username': mlessuname
[mli
], 'avatarurl': mlessavatar
[mli
], 'avatarfullfilename': avatarfilenameext
, 'avatarfilename': avatarfilename
, 'avatarextension': avatarfileextension
} });
458 def get_motherless_girls(httpurl
, httpheaders
, httpcookie
, getlinks
=[0, -1]):
459 mrtext
= download_from_url(httpurl
, httpheaders
, httpcookie
);
460 mregex_getuname
= re
.escape("<a href=\"")+"(.*)"+re
.escape("\" rev=\"")+"([\w\/\?\&\=\.\-]+)"+re
.escape("\" rel=\"")+"(.*)"+re
.escape("\">");
461 mlessuname
= re
.findall(mregex_getuname
, mrtext
);
462 mregex_geturlname
= re
.escape("\n\t\t\t\t\t\t<a href=\"/m/")+"([\w\/\?\&\=\.\-]+)"+re
.escape("\" target=\"_blank\">");
463 mlessurlname
= re
.findall(mregex_geturlname
, mrtext
);
464 if(getlinks
[1]>len(mlesslinkone
) or getlinks
[1]==-1):
465 getlinks
[1] = len(mlesslinkone
);
466 if(getlinks
[0]>getlinks
[1] and not getlinks
[1]==-1):
467 tmpgetlinks0
= getlinks
[0];
468 tmpgetlinks1
= getlinks
[1];
469 getlinks
[0] = tmpgetlinks1
;
470 getlinks
[1] = tmpgetlinks0
;
475 returnval
= {'numoflinks': mlil
};
476 returnval
.update({'numofalllinks': len(mlessuname
)});
477 returnval
.update({'orginurl': httpurl
});
478 returnval
.update({'orginurltype': get_motherless_get_link_type(httpurl
)});
479 mlessrooturltype
= get_motherless_get_link_type(httpurl
);
480 returnval
.update({'urltype': mlessrooturltype
});
482 avatarfilenameext
= os
.path
.basename(urlparse
.urljoin(mlessuname
[mli
][0], urlparse
.urlparse(mlessuname
[mli
][0]).path
));
483 avatarfilename
, avatarfileextension
= os
.path
.splitext(avatarfilenameext
);
484 mlessurltype
= get_motherless_get_link_type("http://motherless.com/"+mlessuname
[mli
][1]);
485 returnval
.update({mli
: {'urltype': mlessurltype
, 'url': "http://motherless.com/"+mlessuname
[mli
][1], 'username': mlessuname
[mli
][1], 'usernamealt': mlessuname
[mli
][2], 'avatarurl': mlessuname
[mli
][0], 'avatarfullfilename': avatarfilenameext
, 'avatarfilename': avatarfilename
, 'avatarextension': avatarfileextension
} });
489 def get_motherless_sample_links(httpheaders
, httpcookie
, numoflinks
=10, urltype
="video"):
490 if(urltype
=="video"):
491 returnval
= {'numoflinks': numoflinks
, 'orginurl': "http://motherless.com/videos", 'orginurltype': get_motherless_get_link_type("http://motherless.com/videos"), 'videos': {'recent': get_motherless_galleries_links("http://motherless.com/videos/recent", httpheaders
, httpcookie
, 1, [0, numoflinks
]), 'favorited': get_motherless_galleries_links("http://motherless.com/videos/favorited", httpheaders
, httpcookie
, 1, [0, numoflinks
]), 'viewed': get_motherless_galleries_links("http://motherless.com/videos/viewed", httpheaders
, httpcookie
, 1, [0, numoflinks
]), 'commented': get_motherless_galleries_links("http://motherless.com/videos/commented", httpheaders
, httpcookie
, 1, [0, numoflinks
]), 'popular': get_motherless_galleries_links("http://motherless.com/videos/popular", httpheaders
, httpcookie
, 1, [0, numoflinks
]), 'live': get_motherless_galleries_links("http://motherless.com/live/videos", httpheaders
, httpcookie
, 1, [0, numoflinks
]), 'random': get_motherless_random_links(httpheaders
, httpcookie
, "video", [0, numoflinks
])} };
492 if(urltype
=="image"):
493 returnval
= {'numoflinks': numoflinks
, 'orginurl': "http://motherless.com/images", 'orginurltype': get_motherless_get_link_type("http://motherless.com/images"), 'images': {'recent': get_motherless_galleries_links("http://motherless.com/images/recent", httpheaders
, httpcookie
, 1, [0, numoflinks
]), 'favorited': get_motherless_galleries_links("http://motherless.com/images/favorited", httpheaders
, httpcookie
, 1, [0, numoflinks
]), 'viewed': get_motherless_galleries_links("http://motherless.com/images/viewed", httpheaders
, httpcookie
, 1, [0, numoflinks
]), 'commented': get_motherless_galleries_links("http://motherless.com/images/commented", httpheaders
, httpcookie
, 1, [0, numoflinks
]), 'popular': get_motherless_galleries_links("http://motherless.com/images/popular", httpheaders
, httpcookie
, 1, [0, numoflinks
]), 'live': get_motherless_galleries_links("http://motherless.com/live/images", httpheaders
, httpcookie
, 1, [0, numoflinks
]), 'random': get_motherless_random_links(httpheaders
, httpcookie
, "image", [0, numoflinks
])} };
494 if(urltype
=="gallery"):
495 returnval
= {'numoflinks': numoflinks
, 'orginurl': "http://motherless.com/galleries", 'orginurltype': get_motherless_get_link_type("http://motherless.com/galleries"), 'galleries': {'updated': get_motherless_galleries_links("http://motherless.com/galleries/updated", httpheaders
, httpcookie
, 1, [0, numoflinks
]), 'created': get_motherless_galleries_links("http://motherless.com/galleries/created", httpheaders
, httpcookie
, 1, [0, numoflinks
]), 'viewed': get_motherless_galleries_links("http://motherless.com/galleries/viewed", httpheaders
, httpcookie
, 1, [0, numoflinks
]), 'favorited': get_motherless_galleries_links("http://motherless.com/galleries/favorited", httpheaders
, httpcookie
, 1, [0, numoflinks
]), 'commented': get_motherless_galleries_links("http://motherless.com/galleries/commented", httpheaders
, httpcookie
, 1, [0, numoflinks
])} };
497 returnval
= {'numoflinks': numoflinks
, 'orginurl': "http://motherless.com/", 'orginurltype': get_motherless_get_link_type("http://motherless.com/"), 'videos': {'recent': get_motherless_galleries_links("http://motherless.com/videos/recent", httpheaders
, httpcookie
, 1, [0, numoflinks
]), 'favorited': get_motherless_galleries_links("http://motherless.com/videos/favorited", httpheaders
, httpcookie
, 1, [0, numoflinks
]), 'viewed': get_motherless_galleries_links("http://motherless.com/videos/viewed", httpheaders
, httpcookie
, 1, [0, numoflinks
]), 'commented': get_motherless_galleries_links("http://motherless.com/videos/commented", httpheaders
, httpcookie
, 1, [0, numoflinks
]), 'popular': get_motherless_galleries_links("http://motherless.com/videos/popular", httpheaders
, httpcookie
, 1, [0, numoflinks
]), 'live': get_motherless_galleries_links("http://motherless.com/live/videos", httpheaders
, httpcookie
, 1, [0, numoflinks
]), 'random': get_motherless_random_links(httpheaders
, httpcookie
, "video", [0, numoflinks
])}, 'images': {'recent': get_motherless_galleries_links("http://motherless.com/images/recent", httpheaders
, httpcookie
, 1, [0, numoflinks
]), 'favorited': get_motherless_galleries_links("http://motherless.com/images/favorited", httpheaders
, httpcookie
, 1, [0, numoflinks
]), 'viewed': get_motherless_galleries_links("http://motherless.com/images/viewed", httpheaders
, httpcookie
, 1, [0, numoflinks
]), 'commented': get_motherless_galleries_links("http://motherless.com/images/commented", httpheaders
, httpcookie
, 1, [0, numoflinks
]), 'popular': get_motherless_galleries_links("http://motherless.com/images/popular", httpheaders
, httpcookie
, 1, [0, numoflinks
]), 'live': get_motherless_galleries_links("http://motherless.com/live/images", httpheaders
, httpcookie
, 1, [0, numoflinks
]), 'random': get_motherless_random_links(httpheaders
, httpcookie
, "image", [0, numoflinks
])}, 'galleries': {'updated': get_motherless_galleries_links("http://motherless.com/galleries/updated", httpheaders
, httpcookie
, 1, [0, numoflinks
]), 'created': get_motherless_galleries_links("http://motherless.com/galleries/created", httpheaders
, httpcookie
, 1, [0, numoflinks
]), 'viewed': get_motherless_galleries_links("http://motherless.com/galleries/viewed", httpheaders
, httpcookie
, 1, [0, numoflinks
]), 'favorited': get_motherless_galleries_links("http://motherless.com/galleries/favorited", httpheaders
, httpcookie
, 1, [0, numoflinks
]), 'commented': get_motherless_galleries_links("http://motherless.com/galleries/commented", httpheaders
, httpcookie
, 1, [0, numoflinks
])} };
500 def get_motherless_get_link_by_type(httpurl
, httpheaders
, httpcookie
, page
=1, getlinks
=[0, -1]):
502 if(get_motherless_get_link_type(httpurl
)=="file"):
503 returnval
= get_motherless_links(httpurl
, httpheaders
, httpcookie
);
504 if(get_motherless_get_link_type(httpurl
)=="gallery"):
505 returnval
= get_motherless_galleries_links(httpurl
, httpheaders
, httpcookie
, page
);
506 if(get_motherless_get_link_type(httpurl
)=="sample-videos"):
507 returnval
= get_motherless_sample_links(httpheaders
, httpcookie
, 10, "video");
508 if(get_motherless_get_link_type(httpurl
)=="sample-images"):
509 returnval
= get_motherless_sample_links(httpheaders
, httpcookie
, 10, "image");
510 if(get_motherless_get_link_type(httpurl
)=="sample-galleries"):
511 returnval
= get_motherless_sample_links(httpheaders
, httpcookie
, 10, "gallery");
512 if(get_motherless_get_link_type(httpurl
)=="sample"):
513 returnval
= get_motherless_sample_links(httpheaders
, httpcookie
, 10, "all");
514 if(get_motherless_get_link_type(httpurl
)=="board"):
515 returnval
= get_motherless_boards_links(httpurl
, httpheaders
, httpcookie
);
516 if(get_motherless_get_link_type(httpurl
)=="member"):
517 returnval
= get_motherless_search_members(httpurl
, httpheaders
, httpcookie
, page
);
518 if(get_motherless_get_link_type(httpurl
)=="girls"):
519 returnval
= get_motherless_girls(httpurl
, httpheaders
, httpcookie
);
520 if(get_motherless_get_link_type(httpurl
)=="download"):
524 def view_motherless_links(httpurl
, httpheaders
, httpcookie
, viewerpro
, prearg
=[], proarg
=[]):
525 commandlist
= [viewerpro
] + prearg
;
526 commandlist
= commandlist
+ [get_motherless_links(httpurl
, httpheaders
, httpcookie
)['url']];
527 commandlist
= commandlist
+ proarg
;
528 mpvplaylistp
= subprocess
.Popen(commandlist
, stdout
=subprocess
.PIPE
, stderr
=subprocess
.PIPE
);
529 mpvplayout
, mpvplayerr
= mpvplaylistp
.communicate();
532 def download_motherless_links(httpurl
, httpheaders
, httpcookie
, sleep
=-1, outfile
="-", outpath
=os
.getcwd(), usetitlename
=False):
533 global geturls_download_sleep
;
535 sleep
= geturls_download_sleep
;
536 mlessurl
= get_motherless_links(httpurl
, httpheaders
, httpcookie
);
537 outputname
= mlessurl
['fullfilename'];
538 outpath
= outpath
.rstrip(os
.path
.sep
);
539 if(usetitlename
==True):
540 outputname
= mlessurl
['title'];
541 if(usetitlename
=="-" and outfile
=="-"):
543 if(usetitlename
=="-" and not outfile
=="-"):
544 outputname
= outfile
;
545 returnval
= download_from_url_to_file(mlessurl
['url'], httpheaders
, httpcookie
, outputname
, outpath
, sleep
);
548 def download_motherless_links_by_type(httpurl
, httpheaders
, httpcookie
, sleep
=-1, outfile
="-", outpath
=os
.getcwd(), usetitlename
=False, page
=1, getlinks
=[0, -1]):
549 global geturls_download_sleep
;
551 sleep
= geturls_download_sleep
;
552 mlessurl
= get_motherless_get_link_by_type(httpurl
, httpheaders
, httpcookie
, page
);
553 if(mlessurl
['urltype']=="download"):
554 outputname
= mlessurl
['fullfilename'];
555 outpathname
= outpath
.rstrip(os
.path
.sep
);
556 if(usetitlename
==True):
557 outputname
= mlessurl
['title'];
558 if(usetitlename
=="-" and outfile
[mli
]=="-"):
560 if(usetitlename
=="-" and not outfile
[mli
]=="-"):
561 outputname
= outfile
;
562 returnval
= download_from_url_to_file(mlessurl
['url'], httpheaders
, httpcookie
, outputname
, outpathname
, sleep
);
563 if(not mlessurl
['urltype']=="download"):
564 returnval
= mlessurl
;
567 def download_motherless_galleries_links(httpurl
, httpheaders
, httpcookie
, sleep
=-1, outfile
="-", outpath
=os
.getcwd(), usetitlename
=False, page
=1, getlinks
=[0, -1]):
568 global geturls_download_sleep
;
570 sleep
= geturls_download_sleep
;
571 mlessgalleries
= get_motherless_galleries_links(httpurl
, httpheaders
, httpcookie
, page
, getlinks
);
573 mlil
= mlessgalleries
['numoflinks'];
574 returnval
= {'pages': mlessgalleries
['pages']};
575 returnval
.update({'numoflists': mlessgalleries
['numoflinks']});
576 returnval
.update({'curpage': mlessgalleries
['curpage']});
577 returnval
.update({'numoflinks': mlessgalleries
['numoflinks']});
578 returnval
.update({'numofalllinks': mlessgalleries
['numofalllinks']});
579 returnval
.update({'orginurl': httpurl
});
580 returnval
.update({'orginurltype': get_motherless_get_link_type(httpurl
)});
582 mlesslink
= get_motherless_links(mlessgalleries
[mli
]['url'], httpheaders
, httpcookie
);
583 outputname
= mlesslink
['fullfilename'];
584 outpath
= outpath
.rstrip(os
.path
.sep
);
585 if(usetitlename
==True):
586 outputname
= mlesslink
['title'];
587 if(usetitlename
=="-" and outfile
=="-"):
589 if(usetitlename
=="-" and not outfile
=="-"):
590 outputname
= outfile
;
591 returnval
.update({mli
: {'download': download_from_url_to_file(mlesslink
['url'], httpheaders
, httpcookie
, outputname
, outpath
, sleep
), 'linkinfo': mlesslink
} });
595 def download_get_motherless_boards_links(httpurl
, httpheaders
, httpcookie
, sleep
=-1, outfile
="-", outpath
=os
.getcwd(), usetitlename
=False, getlinks
=[0, -1]):
596 global geturls_download_sleep
;
598 sleep
= geturls_download_sleep
;
599 mlessgalleries
= get_motherless_boards_links(httpurl
, httpheaders
, httpcookie
, getlinks
);
601 mlil
= mlessgalleries
['numoflinks'];
602 returnval
= {'numoflists': mlessgalleries
['numoflinks']};
603 returnval
.update({'numofalllinks': mlessgalleries
['numofalllinks']});
604 returnval
.update({'orginurl': httpurl
});
605 returnval
.update({'orginurltype': get_motherless_get_link_type(httpurl
)});
607 mlesslink
= get_motherless_links(mlessgalleries
[mli
]['url'], httpheaders
, httpcookie
);
608 outputname
= mlesslink
['fullfilename'];
609 outpath
= outpath
.rstrip(os
.path
.sep
);
610 if(usetitlename
==True):
611 outputname
= mlesslink
['title'];
612 if(usetitlename
=="-" and outfile
=="-"):
614 if(usetitlename
=="-" and not outfile
=="-"):
615 outputname
= outfile
;
616 returnval
.update({mli
: {'download': download_from_url_to_file(mlesslink
['url'], httpheaders
, httpcookie
, outputname
, outpath
, sleep
), 'linkinfo': mlesslink
} });