From 2b1eb54f10a7babd114e216f1be32cb6f313ec46 Mon Sep 17 00:00:00 2001 From: EUcancER Date: Wed, 18 Apr 2012 11:28:20 +0200 Subject: fix url parser --- commands/revip | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/commands/revip b/commands/revip index 1d20037..b4920f5 100755 --- a/commands/revip +++ b/commands/revip @@ -6,6 +6,7 @@ import os import json import socket import httplib +from urlparse import urlparse try: target = sys.argv[1] except: @@ -25,7 +26,7 @@ for a in aliases: sites[a] = "" offset = 0 appid = os.environ.get("BING_APPID",'7A0B8DA3E913BE5ECB4AF11C7BC398B43000DC1C') -while offset < 50: +while offset < 300: url ="/json.aspx?AppId=%s&Query=ip:%s&Sources=Web+RelatedSearch+News+Image+Video&Version=2.2&Market=en-us&Web.Count=50&Web.Offset=%s&Web.Options=DisableQueryAlterations" % (appid, ip, offset) conn = httplib.HTTPConnection("api.bing.net") conn.request("GET", url) @@ -35,7 +36,7 @@ while offset < 50: results = doc["SearchResponse"]["Web"]["Results"] conn.close() for res in results: - sites[res['DisplayUrl']] = "" + sites[urlparse(res['Url'])[1]] = "" offset += 50 except: break -- cgit v1.2.3