Yet another small update.
authorKazuki Przyborowski <[email protected]>
Fri, 22 Jan 2016 07:02:12 +0000 (22 01:02 -0600)
committerKazuki Przyborowski <[email protected]>
Fri, 22 Jan 2016 07:02:12 +0000 (22 01:02 -0600)
MiniScripts/pymotherless-demo.py
MiniScripts/pymotherless.py

index 05e2d7e..2b97cb2 100755 (executable)
@@ -13,7 +13,7 @@
     Copyright 2016 Game Maker 2k - http://intdb.sourceforge.net/
     Copyright 2016 Kazuki Przyborowski - https://github.com/KazukiPrzyborowski
 
-    $FileInfo: pymotherless-demo.py - Last Update: 1/19/2016 Ver. 0.3.0 RC 1 - Author: cooldude2k $
+    $FileInfo: pymotherless-demo.py - Last Update: 1/22/2016 Ver. 0.3.1 RC 1 - Author: cooldude2k $
 '''
 
 from __future__ import division, absolute_import, print_function;
@@ -23,6 +23,7 @@ __program_name__ = pymotherless.__program_name__;
 __version_info__ = pymotherless.__version_info__;
 __version_date__ = pymotherless.__version_date__;
 __version__ = pymotherless.__version__;
+__version_date_plusrc__ = pymotherless.__version_date_plusrc__;
 
 geturls_cj = pymotherless.geturls_cj;
 geturls_ua = pymotherless.geturls_ua;
index b527200..19bf76c 100755 (executable)
@@ -13,7 +13,7 @@
     Copyright 2016 Game Maker 2k - http://intdb.sourceforge.net/
     Copyright 2016 Kazuki Przyborowski - https://github.com/KazukiPrzyborowski
 
-    $FileInfo: pymotherless.py - Last Update: 1/19/2016 Ver. 0.3.0 RC 1 - Author: cooldude2k $
+    $FileInfo: pymotherless.py - Last Update: 1/22/2016 Ver. 0.3.1 RC 1 - Author: cooldude2k $
 '''
 
 from __future__ import division, absolute_import, print_function;
@@ -32,8 +32,9 @@ if(sys.version[0]=="3"):
 #if(__name__ == "__main__"):
 # sys.tracebacklimit = 0;
 __program_name__ = "PyMotherless";
-__version_info__ = (0, 3, 0, "RC 1");
+__version_info__ = (0, 3, 1, "RC 1");
 __version_date__ = "2016.01.19";
+__version_date_plusrc__ = "2016.01.19-1";
 if(__version_info__[3]!=None):
  __version__ = str(__version_info__[0])+"."+str(__version_info__[1])+"."+str(__version_info__[2])+" "+str(__version_info__[3]);
 if(__version_info__[3]==None):
@@ -245,6 +246,8 @@ def get_motherless_get_link_type(httpurl):
   returnval = "member";
  if(mlessvidid[1]=="girls" and len(mlessvidid)==2):
   returnval = "girls";
+ if(mlessvidid[1]=="referers" and len(mlessvidid)==2):
+  returnval = "referers";
  if(mlessvidid_parts.netloc=="cdn.images.motherlessmedia.com" or mlessvidid_parts.netloc=="cdn.videos.motherlessmedia.com" or mlessvidid_parts.netloc=="cdn.thumbs.motherlessmedia.com"):
   returnval = "download";
  if(returnval==False and len(mlessvidid)==2):
@@ -498,6 +501,35 @@ def get_motherless_girls(httpheaders, httpcookie, getlinks=[0, -1]):
   mli = mli + 1;
  return returnval;
 
+def get_motherless_top_referrers(httpheaders, httpcookie, getlinks=[0, -1]):
+ mrtext = download_from_url("http://motherless.com/referers", httpheaders, httpcookie);
+ mregex_geturlname = "([0-9]+)"+re.escape(". <a href=\"")+"(.*)"+re.escape(" class=\"pop\" target=\"_blank\" rel=\"nofollow\">\n                                               ")+"(.*)"+re.escape("                                   </a>");
+ mlessurlname = re.findall(mregex_geturlname, mrtext);
+ if(getlinks[1]>len(mlessurlname) or getlinks[1]==-1):
+  getlinks[1] = len(mlessurlname);
+ if(getlinks[0]>getlinks[1] and not getlinks[1]==-1):
+  tmpgetlinks0 = getlinks[0];
+  tmpgetlinks1 = getlinks[1];
+  getlinks[0] = tmpgetlinks1;
+  getlinks[1] = tmpgetlinks0;
+ if(getlinks[0]<0):
+  getlinks[0] = 0;
+ mli = getlinks[0];
+ mlil = getlinks[1];
+ returnval = {'numoflinks': mlil};
+ returnval.update({'numofalllinks': len(mlessurlname)});
+ returnval.update({'orginurl': "http://motherless.com/referers"});
+ returnval.update({'orginurltype': get_motherless_get_link_type("http://motherless.com/referers")});
+ mlessrooturltype = get_motherless_get_link_type("http://motherless.com/referers");
+ returnval.update({'urltype': mlessrooturltype});
+ while(mli<mlil):
+  returnval.update({mli: {'urltype': "referer-links", 'url': mlessurlname[mli][1], 'title': mlessurlname[mli][2]} });
+  mli = mli + 1;
+ return returnval;
+
+def get_motherless_top_referers(httpheaders, httpcookie, getlinks=[0, -1]):
+ return get_motherless_top_referrers(httpheaders, httpcookie, getlinks);
+
 def get_motherless_sample_links(httpheaders, httpcookie, numoflinks=10, urltype="video"):
  if(urltype=="video"):
   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]) } };