From 3d86a088473d7a248f6fc6a4890483f768eff84d Mon Sep 17 00:00:00 2001 From: Kazuki Przyborowski Date: Fri, 11 Oct 2013 04:03:27 -0500 Subject: [PATCH] yet another small bug fix. --- MiniScripts/motherless-dl.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/MiniScripts/motherless-dl.py b/MiniScripts/motherless-dl.py index e3b7515..b8d4ed9 100755 --- a/MiniScripts/motherless-dl.py +++ b/MiniScripts/motherless-dl.py @@ -13,13 +13,13 @@ Copyright 2013 Game Maker 2k - http://intdb.sourceforge.net/ Copyright 2013 Kazuki Przyborowski - https://github.com/KazukiPrzyborowski - $FileInfo: motherless-dl.py - Last Update: 10/11/2013 Ver. 1.6.4 RC 3 - Author: cooldude2k $ + $FileInfo: motherless-dl.py - Last Update: 10/11/2013 Ver. 1.6.4 RC 4 - Author: cooldude2k $ ''' from __future__ import division, absolute_import, print_function; import re, os, sys, urllib, urllib2, cookielib, StringIO, gzip, time, datetime, argparse, urlparse; sys.tracebacklimit = 0; -__version_info__ = (1, 6, 4, "RC 3"); +__version_info__ = (1, 6, 4, "RC 4"); 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): @@ -240,15 +240,16 @@ def motherless_dl(mtlessgetargs=vars(getargs)): mlessusrname = usrname_text[0]; mlessid = re.sub("^"+re.escape("/"), "", mlessurllist[curlurl]); mlesspurl = "http://motherless.com"+mlessurllist[curlurl]; - regex_numviews = re.escape("Views")+"\n+\t+([0-9\,]+)\t+"+re.escape(""); + regex_numviews = re.escape("Views")+"\n+\t+([^\t]+)\t+"+re.escape(""); numviews_text = re.findall(regex_numviews, subout_text); mlessnumviews = numviews_text[0]; mlessnumviews = re.sub(re.escape(","), "", mlessnumviews); - regex_numfavs = re.escape("Favorited")+"\n+\t+([0-9\,]+)\t+"+re.escape(""); + regex_numfavs = re.escape("Favorited")+"\n+\t+([^\t]+)\t+"+re.escape(""); numfavs_text = re.findall(regex_numfavs, subout_text); mlessnumfavs = numfavs_text[0]; mlessnumfavs = re.sub(re.escape(","), "", mlessnumfavs); - regex_postdata = re.escape("
")+"\n\t+"+re.escape("

")+"\n\t+"+re.escape("")+"\n\t+([\w]+)\t+"+re.escape("")+"\n\t+"+re.escape("

")+"\n\t+"+re.escape("
")+"\n\t+([!-%'-?A-~ ]+)\t+"+re.escape("
")+"\n\t+"+re.escape("
")+"\n\t+([!-%'-?A-~ \<\>\"\'\@\#]+)\t+"+re.escape("
"); + ''' some good regex "!-%'-?A-~ " "!-%'-?A-~ \<\>\"\'\@\#" ''' + regex_postdata = re.escape("
")+"\n\t+"+re.escape("

")+"\n\t+"+re.escape("")+"\n\t+([^\t]+)\t+"+re.escape("")+"\n\t+"+re.escape("

")+"\n\t+"+re.escape("
")+"\n\t+([^\t]+)\t+"+re.escape("
")+"\n\t+"+re.escape("
")+"\n\t+([^\t]+)\t+"+re.escape("
"); postdata_text = re.findall(regex_postdata, subout_text); numpost = len(postdata_text); curpost = 0; @@ -256,7 +257,12 @@ def motherless_dl(mtlessgetargs=vars(getargs)): ''' From Amber @ http://stackoverflow.com/a/9662362 ''' TAG_RE = re.compile(r'<[^>]+>'); while(numpost>0 and curpost"), "\n", postdata_text[curpost][3]); + newpostext = re.sub(re.escape("
"), "\n", newpostext); + newpostext = re.sub(re.escape("
"), "\n", newpostext); + newpostext = TAG_RE.sub('', newpostext); + newpostext = re.sub(re.escape("/")+"([\w\/]+)", r"http://motherless.com/\1", newpostext); + mlesspostlist.append({"username": postdata_text[curpost][0], "avatar": "http://avatars.motherlessmedia.com/avatars/member/"+postdata_text[curpost][0]+".jpg", "smallavatar": "http://avatars.motherlessmedia.com/avatars/member/"+postdata_text[curpost][0]+"-small.jpg", "post": newpostext}); curpost = curpost + 1; if(post_text>0): mlesslink = post_text[0]; -- 2.11.4.GIT