rogerthis wrote:First thing, you need to add load of print statements to your code so you can see what is happening
Second thing this site has major encoding issues. project free tv has as well, so it would be worth having a look at that code.
No cookies are needed, and you don't need the post request either.
Here is working code for getting pasted the 18 + button
http://pastebin.com/VdC4gXjS
Basically, you just call another url with "confirm=1" added in the middle and it works.
Hi Roger. thanks for the reply. On initial test it loaded the page correctly.
However this is just one page of 25 link at a time.
if you take the main_url = 'http://www.movie2k.to/xxx-genre-53-1.html' the number 53 represents a Genre, each Genre has a Number. and the number 1 represent the page number.
Now if i change some of these ie 53 to 40 and 1 to 3 or 4 or 5 etc the page does not load with correct info.
When i check in my web browser the page asks the user to press button to say they are over 18 and then the page reloads with correct info ie. a list of links
i use the code below to check in Idle as it easier. Some the pages load but most dont.
Hope you can help. Its been driving me nuts since last night.
- Code: Select all
from t0mm0.common.net import Net
import urllib2,urllib,re
net = Net()
site_url = 'http://www.movie2k.to/'
url='http://www.movie2k.to/xxx-genre-40-3.html'
try:
#addon.log_debug('fetching %s' % url)
#url = addon.queries['url']
print 'url: '+url
post_url = net.http_GET(url).get_url()
print 'post_url: '+post_url
html = net.http_GET(post_url).content
html = html.encode("utf-8")
#print html
confirm = re.findall('<FORM style="display:inline" method=post action="(.+?)">', html)[0]
print site_url+confirm
post_url = net.http_GET(site_url+confirm).get_url()
print 'post_url: '+post_url
html = net.http_GET(site_url+confirm).content
html = html.encode("utf-8")
except urllib2.URLError, e:
html = ''
print html
Also sometimes i get
IndexError: list index out of range
with confirm = re.findall('<FORM style="display:inline" method=post action="(.+?)">', html)[0]
as it does not find this info
