Exemplo n.º 1
0
 def parse_next(next):
     dbpurl = DbpUrl(next)
     # fetch html
     src = fetch_html(dbpurl.get_url())
     html = Html(src, dbpurl)
     # download photoes
     photoes = html.get_photoes()
     dl_photos(get_photo_list(photoes))
     next = html.next_url()
     if next:
         parse_next(next)
Exemplo n.º 2
0
	def parse_next(next):
		dbpurl = DbpUrl(next)
		# fetch html
		src = fetch_html(dbpurl.get_url())
		html = Html(src, dbpurl)
		# download photoes
		photoes = html.get_photoes()
		dl_photos(get_photo_list(photoes))
		next = html.next_url()
		if next:
			parse_next(next)
Exemplo n.º 3
0
def test():
    albums = [
        'http://www.douban.com/photos/album/85642820/',  # 7
        'http://www.douban.com/online/10859460/album/51259013/',  # 11
        'http://site.douban.com/story/widget/photos/5857547/',  # 4
        'http://www.douban.com/photos/photo/1600191811/',  # 3
        'http://www.douban.com/online/11458796/photo/1852757882/',  # 5
        'http://site.douban.com/doubangongyi/widget/photos/11398597/photo/1775979493/'  # 2
    ]
    for url in albums:
        dbpurl = DbpUrl(url)
        if dbpurl.is_valid():
            parse_html(dbpurl)
        else:
            print('unaccepted url')
Exemplo n.º 4
0
def test():
	albums = [
		'http://www.douban.com/photos/album/85642820/', # 7
		'http://www.douban.com/online/10859460/album/51259013/', # 11
		'http://site.douban.com/story/widget/photos/5857547/', # 4
		'http://www.douban.com/photos/photo/1600191811/', # 3
		'http://www.douban.com/online/11458796/photo/1852757882/', # 5
		'http://site.douban.com/doubangongyi/widget/photos/11398597/photo/1775979493/' # 2
	]
	for url in albums:
		dbpurl = DbpUrl(url)
		if dbpurl.is_valid():
			parse_html(dbpurl)
		else:
			print('unaccepted url')
Exemplo n.º 5
0
def dbp_loop():
    try:
        while True:
            url = raw_input(u2c('\n输入豆瓣相册地址: '))
            dbpurl = DbpUrl(url)
            if dbpurl.is_valid():
                parse_html(dbpurl)
            else:
                u2c_print('输入地址不合法TT')
    except (KeyboardInterrupt, SystemExit):
        # user wants to quit
        res = raw_input(u2c('\n确认退出程序?(Y/N)'))
        if res not in 'yY':
            dbp_loop()
    except Exception:
        u2c_print('\n出错误了TT!')
        dbp_loop()
Exemplo n.º 6
0
def dbp_loop():
	try:
		while True:
			url = raw_input(u2c('\n输入豆瓣相册地址: '))
			dbpurl = DbpUrl(url)
			if dbpurl.is_valid():
				parse_html(dbpurl)
			else:
				u2c_print('输入地址不合法TT')
	except (KeyboardInterrupt, SystemExit):
		# user wants to quit
		res = raw_input(u2c('\n确认退出程序?(Y/N)'))
		if res not in 'yY':
			dbp_loop()
	except Exception:
		u2c_print('\n出错误了TT!')
		dbp_loop()