Example #1
0
import httplib2
import re
import base64 as b64
import sys
sys.path.append(r'D:\Dev\Python\Workspace\convHans')
import convHans
selcard = '{"p":"%d","quality":"%d","sort":"quality.desc"}'
cardlist = {'tw':'http://db.duowan.com/ma/card/list/', 'cn':'http://db.duowan.com/ma/cn/card/list/'}
regex = {'tw':'<img title="([^"]+)" style="height:60px" class="img-rounded" src="http://img.dwstatic.com/ma/pic/face/face_(\d+).jpg">', \
		'cn':'<img title="([^"]+)" style="height:60px" class="img-rounded" src="http://img.dwstatic.com/ma/zh_pic/face/face_(\d+).jpg">', \
		'extra':'width="40px">(.*?)</td'}
dbdir = r'D:\Dev\Python\Workspace\maClient\\'
ht = httplib2.Http()
reload(sys)
sys.setdefaultencoding('utf-8')
h = convHans.convHans()
for loc in ['tw', 'cn']:
	print loc
	open(dbdir + 'db/card.%s.txt' % loc, 'w').write('')
	for j in range(1, 7):
		clist = []
		maxpage = 4
		i = 1
		while (i <= maxpage):
			resp, ct = ht.request(cardlist[loc] + b64.encodestring(selcard % (i, j)).strip('\n').replace('=', '_3_') + '.html')
			nav = re.findall('mod-page center.*?</div>', ct, re.DOTALL)[0]
			maxpage = len(re.findall('href', nav)) - 2
			print i, maxpage, j
			i += 1
			tr = re.findall('tr[^c]*class="even">(.*?)<\/tr', ct, re.DOTALL)
			for t in tr:
Example #2
0
            if self.picmode:self.prt_q.put([self.getName(), '#%s %s (%d) 下载完成.' % (index, taskname, len(content))])
            else:self.prt_q.put([self.getName(), url])
        self.prt_q.put([self.getName(), '已退出.'])

def save2file(content, name, hath):
    filename = opth.join(hath.dirpath, legalpath(name))
    fileHandle = open(filename, 'wb')
    fileHandle.write(content)
    fileHandle.close()


if __name__ == '__main__':
    try:
        reload(sys)
        sys.setdefaultencoding('utf-8')
        chans = convHans.convHans()
        # 是否命令行模式
        is_silent = False
        argdict = parse_arg(sys.argv[1:])
        is_silent = argdict['url'] or False
        if is_silent:argdict['log'] = argdict['log'] or opth.join(getPATH0(), 'eh.log')
        prompt('绅♂士下载器 v' + str(__version__), fill = ' ')
        # 交互界面或从命令行读取参数
        if argdict['uname'] and argdict['key']:mkcookie(argdict['uname'], argdict['key'])
        else:
            if not getcookie():
                if _raw_input('当前没有登陆,要登陆吗 y/n? (双倍配额限制,可访问exhentai):') == 'y':mkcookie()
        while True:
            exurl_all = _raw_input('输入地址(使用,分割下载多个):', is_silent, argdict['url']).replace(','.decode('utf-8'), ',')
            if not (exurl_all.startswith('http://g.e-hentai.org/') or exurl_all.startswith('http://exhentai.org/')\
                     or exurl_all.startswith('g.e-hentai.org/') or exurl_all.startswith('exhentai.org/')) \
Example #3
0
import httplib2
import re
import base64 as b64
import sys
sys.path.append(r'D:\Dev\Python\Workspace\convHans')
import convHans
selcard = '{"p":"%d","quality":"%d","sort":"quality.desc"}'
cardlist = {'tw':'http://db.duowan.com/ma/card/list/', 'cn':'http://db.duowan.com/ma/cn/card/list/'}
regex = {'tw':'<img title="([^"]+)" style="height:60px" class="img-rounded" src="http://img.dwstatic.com/ma/pic/face/face_(\d+).jpg">', \
		'cn':'<img title="([^"]+)" style="height:60px" class="img-rounded" src="http://img.dwstatic.com/ma/zh_pic/face/face_(\d+).jpg">', \
		'extra':'width="40px">(.*?)</td'}
dbdir = r'D:\Dev\Python\Workspace\MAClient\\'
ht = httplib2.Http()
reload(sys)
sys.setdefaultencoding('utf-8')
h = convHans.convHans()
for loc in ['tw', 'cn']:
	print loc
	open(dbdir + 'db/card.%s.txt' % loc, 'w').write('')
	for j in range(1, 7):
		clist = []
		maxpage = 4
		i = 1
		while (i <= maxpage):
			resp, ct = ht.request(cardlist[loc] + b64.encodestring(selcard % (i, j)).strip('\n').replace('=', '_3_') + '.html')
			nav = re.findall('mod-page center.*?</div>', ct, re.DOTALL)[0]
			maxpage = len(re.findall('href', nav)) - 2
			print i, maxpage, j
			i += 1
			tr = re.findall('tr[^c]*class="even">(.*?)<\/tr', ct, re.DOTALL)
			for t in tr: