246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
|
# Use literal station title now
title = row["title"]
#title = title.group(0).replace(" ", "%20")
# Do 'le google search
html = ahttp.get("http://www.google.com/search", params=dict(hl="en", q=title, client="streamtuner2"), ajax=1, timeout=3.5)
log.DATA(re.sub("<(script|style)[^>]*>.*?</(script|style)>", "", html, 100, re.S))
# Find first URL hit
url = rx_u.findall(html)
if url:
log.DATA(url)
row["homepage"] = ahttp.fix_url(url[0])
return True
pass
#-----------------
|
|
|
|
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
|
# Use literal station title now
title = row["title"]
#title = title.group(0).replace(" ", "%20")
# Do 'le google search
html = ahttp.get("http://www.google.com/search", params=dict(hl="en", q=title, client="streamtuner2"), ajax=1, timeout=3.5)
#log.DATA(re.sub("<(script|style)[^>]*>.*?</(script|style)>", "", html, 100, re.S))
# Find first URL hit
url = rx_u.findall(html)
if url:
#log.DATA(url)
row["homepage"] = ahttp.fix_url(url[0])
return True
pass
#-----------------
|