Going To next Page
#1
Hello friends,
some days ago i have started a project = make a plugin video, i have made some code and play the video work fine,but now i am stuck in one part,
Going to next page,i have already try several codes but just one make a litle what i need to do,


PHP Code:
def listar_videos(url):
    
codigo_fonte abrir_url(url)
    
soup bs(abrir_url(url))
    
content bs(soup.find("div", { "id" "dle-content" }).prettify())
    
filmes content("div", { "class" "short-film" })
    for 
filme in filmes:
        
nome_filme filme.img["alt"]
        
url filme.a["href"].replace('Assistir ','')
        
img filme.img["src"]
        
addDir(nome_filme.encode('utf8'),url,4,img,False,len(filmes)) 
            
#My problem is in this next line,whith this code i can go to http://blablabla.com/films/page/2/ but when i hit again to go to http://blablabla.com/films/page/3/  its goin back to http://blablabla.com/films/page/1/ 

        
pages content("div", { "class" "navigation" })
        for 
page in pages:
        
url page.a["href"]
         
addDir('Next Page >>',url,2,artfolder 'prox.png'

Thanks to advance
Reply
#2
Looks like url contains 'http://blablabla.com/films/page/1/' instead of 'http://blablabla.com/films/page/3/' then.

I usually put the current url in the parameters (let's say 'http://blablabla.com/films/page/1/'). When a user presses next, i get the current url from the parameters and add 1 to the number in it (so it becomes 'http://blablabla.com/films/page/2/') and save that url in the parameters.

See f.e. dumpert_list.py in the dumpert add-on.
Reply
#3
Hi skipmode A1, i have tried whith your code and i guess i make some mistaques,
I have a question and maybe you can help:

This is the original code :

PHP Code:
def listar_videos(url):
    
codigo_fonte abrir_url(url)
    
soup bs(abrir_url(url))
    
content bs(soup.find("div", { "id" "dle-content" }).prettify())
    
filmes content("div", { "class" "short-film" })
    for 
filme in filmes:
        
nome_filme filme.img["alt"]
        
url filme.a["href"].replace('Assistir ','')
        
img filme.img["src"]
        
addDir(nome_filme.encode('utf8'),url,4,img,False,len(filmes)) 
            
     
#This code for websites wordpress works fine
       
pages bs(soup.find('div', { "class" "wp-pagenavi" }).prettify())("a", { "class" "nextpostslink" })[0]["href"]
    
addDir('Next Page >>',pages,2,artfolder 'prox.png')
     
    
#But when i change for my divs dont work
   
pages bs(soup.find('div', { "class" "pages" }).prettify())("div", { "class" "nextprev" })[0]["href"]
        
addDir('Next Page >>',pages,2,artfolder 'prox.png'

#The HTML from the page
http://prntscr.com/83tn4w
Thanks
Reply
#4
Dunno. Debug that stuff. Do a xmbc.log(str(pages)) to see the value of the variable pages in the xbmc.log.
Reply

Logout Mark Read Team Forum Stats Members Help
Going To next Page0