Exemplo n.º 1
0
def mangaChapter(start_url):
	#given the starting url, gets all the pages

	start_time = time.time()

	bcolor.printBlue(start_url)

	#mangahere note first page of every chapter is page/ with the nth page being page/n.html
	#mangapanda note first page of every chapter is page/ with the nth page being page/n
	#if "mangahere" in start_url:
		#url_end = ".html"
	#elif "mangapanda" in start_url:
		#url_end = ""
	#else:
		#sys.exit()


	
	curr_image = imageGrab(start_url, "01")

	if curr_image == "":
		count = 0
	else:
		count = 1

	#always loop
	while True:

		#set the last image
		last_image = curr_image

		#increment count
		count = count + 1

		#construct the next url
		next_url = start_url + str(count)
		#print next_url

		#get the number as the string
		numString = getNum(count)

		#get the image url we just 
		curr_image = imageGrab(next_url, numString)
		#print next_url

		if not curr_image:
			break

		if curr_image == last_image:
			break


	etime = time.time() - start_time
	bcolor.printGreen("Elapsed time: " + str(etime) +"\nFiles downloaded: " + str(count) +"\n")
Exemplo n.º 2
0
import mangaDownloader
import bcolor


#test url1 404
testurl1 = "http://www.mangapanda.com/shingeki-no-kyojin/53/48"

image = mangaDownloader.imageGrab(testurl1, "test1")

if not image:
	bcolor.printGreen("Test 1 (404 handling) success!\n")
else:
	bcolor.printRed("Test 1 (404 handling) failed!\n")

#test url2 mangapanda
testurl2 = "http://www.mangapanda.com/shingeki-no-kyojin/53/"

image = mangaDownloader.imageGrab(testurl2, "test2")

if image == "http://i13.mangapanda.com/shingeki-no-kyojin/53/shingeki-no-kyojin-4699239.jpg":
	bcolor.printGreen("Test 2 (mangapanda single image download) success!\n")
else:
	bcolor.printRed("Test 2 (mangapanda single image download) failed!\n")