Here is my code right now:
front_deeplink = ("http://www.jsox.de")
Spider = 20
Region = 7236
def trade_spider(max_pages):
for reg in Region:
page = 0
while page <= max_pages:
page += 1
r = requests.get("http://www.jsox.de/affiliatesearch.aspx?®ionid=" + str(reg) + "&pid=" + str(page))
soup = BeautifulSoup(r.content)
g_data = soup.find_all("div", {"class": "gridHeadOuter productInfoOuter"})
for item in g_data:
Header = item.find_all("div", {"class": "offerInto"})
Header_final = (Header[0].contents[0].text.strip())
price = item.find_all("strong", {"class": "priceBig priceBlock"})
Price_final = (price[0].text.strip())
Deeplink = item.find_all("a")
for t in set(t.get("href") for t in Deeplink):
Deeplink_final = (str(front_deeplink) + t)
print("Header: " + Header_final + " | " + "Price: " + Price_final[:-1] + " | " + "Deeplink: " + Deeplink_final)
trade_spider(int(Spider))
However, I keep getting the error message:
for reg in Region:
TypeError: 'int' object is not iterable
when I try and run this.
What am I doing wrong?
Can anyone help me with that? Any feedback is appreciated.
Region = 7236, which is anint, so, like the error says, you cannot iterate over it.7236?for reg in 7236if you know that7236is the value ofRegion?