def listURL(mode, name, url, iconimage, desc, num, viewtype, fanart):
	from shared_modules3 import addDir
	printpoint = "" ; TypeError = "" ; extra = ""
	if mode == 41 or mode == 42:
		url += getUserAgent()
		iconimage += getUserAgent()

	addDir(name, url, mode, iconimage, desc, str(num), viewtype, fanart)
	
	if mode == 42:
		return url
def listURL(mode, name, url, iconimage, desc, num, viewtype, fanart):
    from shared_modules3 import addDir
    printpoint = ""
    TypeError = ""
    extra = ""
    if mode == 41 or mode == 42:
        url += getUserAgent()
        iconimage += getUserAgent()

    addDir(name, url, mode, iconimage, desc, str(num), viewtype, fanart)

    if mode == 42:
        return url
def listURLS_2(id_L, title_L, thumb_L, desc_L, mode, name, url, iconimage, desc, page, viewtype, fanart):
	extra = "" ; TypeError = "" ; pageL = [] ; match_page = "" ; match_page2 = ""
	pageP = int(page) - 1
	pageN = int(page) + 1
	html_ = GetHTML(url)

	if 1 + 1 == 3:
		match_page = regex_from_to(html_, '<article class', '</article>', excluding=False)
		match_page2 = re.compile('<a href="(.+?)">(.+?)</a>').findall(match_page)
		for page_url, page_num in match_page2:
			try: pageL.append(int(page_num))
			except Exception, TypeError: extra = extra + newline + 'TypeError' + space2 + str(TypeError) + space + 'page_num' + space2 + str(page_num)
	
	if mode == 42:
		page = random.choice(pageL)
		
	html = '<article class' + html_.split('<article class', 1)[-1]
	
	match = re.compile('<a href="(.+?)" title="(.+?)"><img src="(.+?)" alt=.+?<span class="title"><a href=".+?" title=".+?">(.+?)</a></span></div>').findall(html)

	if pageP in pageL:
		from shared_modules3 import addDir
		listURL(40, 'Previous Page', url, iconimage, desc, str(pageP), viewtype, fanart)
		addDir('Home','plugin://' + addonID,8,featherenceserviceicons_path + 'home.png',desc,'1',50,fanart)
	i = 0
	for url2, desc2, iconimage2, name2 in match:
		url2 = url2.replace('/cartoon/', '/video/')
		url2 = url2.replace('.html', '.mp4')
		if mode == 42:
			id_L, title_L, thumb_L, desc_L = listURLS(id_L, title_L, thumb_L, desc_L, url2, desc2, iconimage2, name2)
		else:
			listURL(41, name2, url2, iconimage2, desc2, str(page), viewtype, fanart)
		i += 1
	if pageN in pageL:
		listURL(40, 'Next Page', url, iconimage, desc, str(pageN), viewtype, fanart)
	
	total = i
	return id_L, title_L, thumb_L, desc_L, extra, url, html, match, match_page, total, pageL
    if mode == 42:
        page = random.choice(pageL)

    html = '<div class="cartoon">' + html_.split('<div class="cartoon">',
                                                 1)[-1]

    match = re.compile(
        '<div class="cartoon"><a class="img" href="(.+?)" title="(.+?)"><img src="(.+?)" alt=.+?<span class="title"><a href=".+?" title=".+?">(.+?)</a></span></div>'
    ).findall(html)

    if pageP in pageL:
        from shared_modules3 import addDir
        listURL(40, 'Previous Page', url, iconimage, desc, str(pageP),
                viewtype, fanart)
        addDir('Home', 'plugin://' + addonID, 8,
               featherenceserviceicons_path + 'home.png', desc, '1', 50,
               fanart)
    i = 0
    for url2, desc2, iconimage2, name2 in match:
        url2 = url2.replace('/cartoon/', '/video/')
        url2 = url2.replace('.html', '.mp4')
        if mode == 42:
            id_L, title_L, thumb_L, desc_L = listURLS(id_L, title_L, thumb_L,
                                                      desc_L, url2, desc2,
                                                      iconimage2, name2)
        else:
            listURL(41, name2, url2, iconimage2, desc2, str(page), viewtype,
                    fanart)
        i += 1
    if pageN in pageL:
        listURL(40, 'Next Page', url, iconimage, desc, str(pageN), viewtype,
            )

    if mode == 42:
        page = random.choice(pageL)

    html = '<div class="cartoon">' + html_.split('<div class="cartoon">', 1)[-1]

    match = re.compile(
        '<div class="cartoon"><a class="img" href="(.+?)" title="(.+?)"><img src="(.+?)" alt=.+?<span class="title"><a href=".+?" title=".+?">(.+?)</a></span></div>'
    ).findall(html)

    if pageP in pageL:
        from shared_modules3 import addDir

        listURL(40, "Previous Page", url, iconimage, desc, str(pageP), viewtype, fanart)
        addDir("Home", "plugin://" + addonID, 8, featherenceserviceicons_path + "home.png", desc, "1", 50, fanart)
    i = 0
    for url2, desc2, iconimage2, name2 in match:
        url2 = url2.replace("/cartoon/", "/video/")
        url2 = url2.replace(".html", ".mp4")
        if mode == 42:
            id_L, title_L, thumb_L, desc_L = listURLS(id_L, title_L, thumb_L, desc_L, url2, desc2, iconimage2, name2)
        else:
            listURL(41, name2, url2, iconimage2, desc2, str(page), viewtype, fanart)
        i += 1
    if pageN in pageL:
        listURL(40, "Next Page", url, iconimage, desc, str(pageN), viewtype, fanart)

    total = i
    return id_L, title_L, thumb_L, desc_L, extra, url, html, match, match_page, total, pageL