Help with my First Add on

Hi, im trying to build my First Add on, and editing the add on that already installed in my kodi
html code can be found in the next post, im trying to replace it with the new target source

Code:
def INDEX(url):
        link = GetContent(url)
        try:
            link=link.encode("UTF-8")
        except:pass
        link = ''.join(link.splitlines()).replace('\t','')
        soup = BeautifulSoup(link)
        vidcontent=soup.findAll('div', {"id" : "archive-posts"})
        
        if(len(vidcontent)==0):
            vidcontent=soup.findAll('div', {"id" : "content"})
        viditems=vidcontent[0].findAll('div', {"class" : "entry-thumbnails"})
        if(len(viditems)>0):
            for item in viditems:
                vimg=""
                if(len(item('a'))>0):
                    linkobj=item('a')[0]
                    if(linkobj.img!=None):
                        vimg=linkobj.img["src"]
                        vname=linkobj.img["title"]
                    vurl=linkobj["href"]
                    try:
                        vname=vname.encode("utf-8","ignore")
                    except: pass
                    addDir(vname.replace("–","-").replace("’","'"),vurl,4,vimg.replace("http://","//").replace("//","http://"))
        else:
            for item in vidcontent[0].findAll('li'):
                vimg=""
                linkobj=item('a')[0]
                vname=linkobj.contents[0].encode("utf-8","ignore")
                vurl=linkobj["href"]
                try:
                    vname=vname.encode("utf-8","ignore")
                except: pass
                addDir(vname.replace("–","-").replace("’","'"),vurl,4,vimg.replace("http://","//").replace("//","http://"))