Reputation: 1
I can't find what I need to change in order to make it run, url and cookies are removed for my account safety etc. What it is supposed to do is increment the url and tell me if it finds a page that has a string of html in its coding. It just displays error messages.
import urllib
import urllib2
import cookielib
import re
import os
from random import choice
item = '0'
password= '0'
cj = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
opener.addheaders = [
('User-Agent', ''),
('Cookie', ''),
]
## Login
values = {}
print "",
url = "**************login.php"
data = urllib.urlencode(values)
home = opener.open(url)
#### START LOOP
i = 0
items = 0
page =["*****************&id="]
while x < 900:
i += 1
url = page + str(i)
home = opener.open(url).read()
#print home
match = re.search(r"<center>You do not have", home)
if match:
link = match.group(1)
print (page + str(i))
Upvotes: 0
Views: 250
Reputation: 993015
The following line:
page =["*****************&id="]
initialises page
as a list containing one string. When you later do page + str(i)
, you're trying to add a list and a string, which doesn't make sense. Change the above line to:
page = "*****************&id="
and you will avoid that error.
Upvotes: 1