From 27ba729edaeac4be687a85266d1e1e7b75154c7f Mon Sep 17 00:00:00 2001 From: Kazuki Przyborowski Date: Thu, 14 Jan 2016 10:02:02 -0600 Subject: [PATCH] Small update. --- MiniScripts/pymotherless-demo.py | 4 +- MiniScripts/pymotherless.py | 156 +++++++++++---------------------------- 2 files changed, 44 insertions(+), 116 deletions(-) diff --git a/MiniScripts/pymotherless-demo.py b/MiniScripts/pymotherless-demo.py index d1f4bc5..94104df 100755 --- a/MiniScripts/pymotherless-demo.py +++ b/MiniScripts/pymotherless-demo.py @@ -13,11 +13,9 @@ Copyright 2016 Game Maker 2k - http://intdb.sourceforge.net/ Copyright 2016 Kazuki Przyborowski - https://github.com/KazukiPrzyborowski - $FileInfo: motherless-dl.py - Last Update: 1/14/2016 Ver. 0.2.2 RC 1 - Author: cooldude2k $ + $FileInfo: motherless-dl.py - Last Update: 1/14/2016 Ver. 0.2.4 RC 1 - Author: cooldude2k $ ''' -# https://raw.githubusercontent.com/GameMaker2k/Python-Scripts/master/MiniScripts/motherless-dl.py - from __future__ import division, absolute_import, print_function; import re, os, sys, pymotherless, argparse; diff --git a/MiniScripts/pymotherless.py b/MiniScripts/pymotherless.py index 38d3cba..736d6a5 100755 --- a/MiniScripts/pymotherless.py +++ b/MiniScripts/pymotherless.py @@ -13,11 +13,9 @@ Copyright 2016 Game Maker 2k - http://intdb.sourceforge.net/ Copyright 2016 Kazuki Przyborowski - https://github.com/KazukiPrzyborowski - $FileInfo: pymotherless.py - Last Update: 1/14/2016 Ver. 0.2.2 RC 1 - Author: cooldude2k $ + $FileInfo: pymotherless.py - Last Update: 1/14/2016 Ver. 0.2.4 RC 1 - Author: cooldude2k $ ''' -# https://raw.githubusercontent.com/GameMaker2k/Python-Scripts/master/MiniScripts/motherless-dl.py - from __future__ import division, absolute_import, print_function; import re, os, sys, urllib, gzip, time, datetime, argparse, cgi, subprocess; if(sys.version[0]=="2"): @@ -34,7 +32,7 @@ if(sys.version[0]=="3"): if(__name__ == "__main__"): sys.tracebacklimit = 0; __program_name__ = "PyMotherless"; -__version_info__ = (0, 2, 2, "RC 1"); +__version_info__ = (0, 2, 4, "RC 1"); __version_date__ = "2016.01.14"; if(__version_info__[3]!=None): __version__ = str(__version_info__[0])+"."+str(__version_info__[1])+"."+str(__version_info__[2])+" "+str(__version_info__[3]); @@ -275,15 +273,6 @@ def get_motherless_links(httpurl, httpheaders, httpcookie): returnval = {'type': mlesslinkone[0][1], 'url': "http://cdn."+mlesslinkone[0][0]+".motherlessmedia.com/"+mlesslinkone[0][1]+"/"+mlesslinkone[0][2], '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}; return returnval; -def get_motherless_links_from_list(httpurl, httpheaders, httpcookie): - mli = 0; - mlil = len(httpurl); - returnval = {'numoflists': mlil}; - while(mli")+"([0-9]+)"+re.escape(""); @@ -331,24 +320,6 @@ def get_motherless_galleries_links(httpurl, httpheaders, httpcookie, page=1, get mli = mli + 1; return returnval; -def get_motherless_galleries_links_from_list(httpurl, httpheaders, httpcookie, page, getlinks): - mli = 0; - mlil = len(httpurl); - returnval = {'numoflists': mlil}; - while(mlilen(mlesslinkone) or getlinks[mli][1]==-1): - getlinks[mli][1] = len(mlesslinkone); - if(getlinks[mli][0]>getlinks[mli][1] and not getlinks[mli][1]==-1): - tmpgetlinks0 = getlinks[mli][0]; - tmpgetlinks1 = getlinks[mli][1]; - getlinks[mli][0] = tmpgetlinks1; - getlinks[mli][1] = tmpgetlinks0; - if(getlinks[mli][0]<0): - getlinks[mli][0] = 0; - returnval.update({mli: get_motherless_galleries_links(httpurl[mli], httpheaders, httpcookie, page[mli], getlinks[mli])}); - mli = mli + 1; - return returnval; - def get_motherless_boards_links(httpurl, httpheaders, httpcookie, getlinks=[0, -1]): mrtext = download_from_url(httpurl, httpheaders, httpcookie); mregex_geturlone = re.escape(""); @@ -378,15 +349,6 @@ def get_motherless_boards_links(httpurl, httpheaders, httpcookie, getlinks=[0, - mli = mli + 1; return returnval; -def get_motherless_boards_links_from_list(httpurl, httpheaders, httpcookie, page): - mli = 0; - mlil = len(httpurl); - returnval = {'numoflists': mlil}; - while(mli")+"([0-9]+)"+re.escape(""); @@ -430,15 +392,6 @@ def get_motherless_search_members(httpurl, httpheaders, httpcookie, page=1, getl mli = mli + 1; return returnval; -def get_motherless_search_members_from_list(httpurl, httpheaders, httpcookie, page): - mli = 0; - mlil = len(httpurl); - returnval = {'numoflists': mlil}; - while(mli"); @@ -468,24 +421,6 @@ def get_motherless_girls(httpurl, httpheaders, httpcookie, getlinks=[0, -1]): mli = mli + 1; return returnval; -def get_motherless_girls_from_list(httpurl, httpheaders, httpcookie, getlinks): - mli = 0; - mlil = len(httpurl); - returnval = {'numoflists': mlil}; - while(mlilen(mlesslinkone) or getlinks[mli][1]==-1): - getlinks[mli][1] = len(mlesslinkone); - if(getlinks[mli][0]>getlinks[mli][1] and not getlinks[mli][1]==-1): - tmpgetlinks0 = getlinks[mli][0]; - tmpgetlinks1 = getlinks[mli][1]; - getlinks[mli][0] = tmpgetlinks1; - getlinks[mli][1] = tmpgetlinks0; - if(getlinks[mli][0]<0): - getlinks[mli][0] = 0; - returnval.update({mli: get_motherless_girls(httpurl[mli], httpheaders, httpcookie, getlinks[mli])}); - mli = mli + 1; - return returnval; - def get_motherless_get_link_by_type(httpurl, httpheaders, httpcookie, page=1, getlinks=[0, -1]): returnval = False; if(get_motherless_get_link_type(httpurl)=="file"): @@ -502,15 +437,6 @@ def get_motherless_get_link_by_type(httpurl, httpheaders, httpcookie, page=1, ge returnval = httpurl; return returnval; -def get_motherless_get_link_by_type_from_list(httpurl, httpheaders, httpcookie, page): - mli = 0; - mlil = len(httpurl); - returnval = {'numoflists': mlil}; - while(mlilen(mlesslinkone) or getlinks[mli][1]==-1): - getlinks[mli][1] = len(mlesslinkone); - if(getlinks[mli][0]>getlinks[mli][1] and not getlinks[mli][1]==-1): - tmpgetlinks0 = getlinks[mli][0]; - tmpgetlinks1 = getlinks[mli][1]; - getlinks[mli][0] = tmpgetlinks1; - getlinks[mli][1] = tmpgetlinks0; - if(getlinks[mli][0]<0): - getlinks[mli][0] = 0; - mlessurl = get_motherless_get_link_by_type(httpurl[mli], httpheaders, httpcookie, page[mli], getlinks[mli]); - if(mlessurl['linktype']=="download"): - outputname = mlessurl['fullfilename']; - outpathname = outpath[mli].rstrip(os.path.sep); - if(usetitlename[mli]==True): - outputname = mlessurl['title']; - if(usetitlename[mli]=="-" and outfile[mli]=="-"): - outputname = "-"; - if(usetitlename[mli]=="-" and not outfile[mli]=="-"): - outputname = outfile[mli]; - returnval = download_from_url_to_file(mlessurl['url'], httpheaders, httpcookie, outputname, outpathname, sleep); - if(not mlessurl['linktype']=="download"): - returnval = mlessurl; + mlesslink = get_motherless_links(mlessgalleries[mli]['url'], httpheaders, httpcookie); + outputname = mlesslink['fullfilename']; + outpath = outpath.rstrip(os.path.sep); + if(usetitlename==True): + outputname = mlesslink['title']; + if(usetitlename=="-" and outfile=="-"): + outputname = "-"; + if(usetitlename=="-" and not outfile=="-"): + outputname = outfile; + returnval.update({mli: {'download': download_from_url_to_file(mlesslink['url'], httpheaders, httpcookie, outputname, outpath, sleep)}}); mli = mli + 1; return returnval; -- 2.11.4.GIT