import requests
import re
cookies = {}
# Step 1: Authenticate
soap_auth = '''
35058
bf0b9eef0da6caf55fe614518375280fe5c4ecca
false
nl_NL
false
'''
r = requests.post('https://ws.tradetracker.com/soap/affiliate',
data=soap_auth,
headers={'Content-Type': 'text/xml; charset=utf-8', 'SOAPAction': 'authenticate'},
timeout=15)
cookies = r.cookies
print(f'Auth: {r.status_code}, cookies: {dict(cookies)}')
# Step 2: Get campaigns (affiliatePrograms)
soap_campaigns = '''
'''
r2 = requests.post('https://ws.tradetracker.com/soap/affiliate',
data=soap_campaigns,
headers={'Content-Type': 'text/xml; charset=utf-8', 'SOAPAction': 'getCampaigns'},
cookies=cookies, timeout=30)
print(f'\ngetCampaigns: {r2.status_code}')
# Extract campaign info
campaigns = re.findall(r'- ]*>(.*?)
', r2.text, re.DOTALL)
print(f'Found {len(campaigns)} campaigns')
for c in campaigns[:30]:
cid = re.search(r']*>(.*?)', c)
name = re.search(r']*>(.*?)', c)
info = re.search(r']*>(.*?)', c)
url_match = re.search(r']*>(.*?)', c)
cat = re.search(r']*>(.*?)', c)
if cid and name:
cname = name.group(1)
# Filter for sneaker-related
keywords = ['sneaker', 'schoen', 'shoe', 'sport', 'nike', 'adidas', 'puma', 'asics', 'new balance', 'foot']
is_relevant = any(kw in cname.lower() for kw in keywords)
marker = ' ***' if is_relevant else ''
print(f' [{cid.group(1)}] {cname}{marker}')
# Step 3: Try getFeedProducts or getProductFeeds
print('\n--- Trying getProductFeeds ---')
soap_pf = '''
'''
r3 = requests.post('https://ws.tradetracker.com/soap/affiliate',
data=soap_pf,
headers={'Content-Type': 'text/xml; charset=utf-8', 'SOAPAction': 'getProductFeeds'},
cookies=cookies, timeout=30)
print(f'getProductFeeds: {r3.status_code}')
# Print condensed
feeds = re.findall(r'- ]*>(.*?)
', r3.text, re.DOTALL)
print(f'Found {len(feeds)} product feeds')
for f in feeds[:40]:
fid = re.search(r']*>(.*?)', f)
name = re.search(r']*>(.*?)', f)
url_match = re.search(r']*>(.*?)', f)
pcount = re.search(r']*>(.*?)', f)
camp_name = re.search(r']*>(.*?)', f)
if fid and name:
n = name.group(1)
cn = camp_name.group(1) if camp_name else '?'
pc = pcount.group(1) if pcount else '?'
url_str = url_match.group(1) if url_match else '?'
keywords = ['sneaker', 'schoen', 'shoe', 'sport', 'nike', 'adidas', 'puma', 'asics', 'foot']
is_relevant = any(kw in n.lower() or kw in cn.lower() for kw in keywords)
marker = ' ***' if is_relevant else ''
print(f' [{fid.group(1)}] {n} ({cn}) [{pc} products]{marker}')
if is_relevant and url_match:
print(f' URL: {url_str[:120]}')