| skipped 37 lines |
38 | 38 | | self._google = 'https://www.google.com/complete/search?q=<Q>&cp=&client=psy-ab&xssi=t&gs_ri=gws-wiz&hl=&authuser=0&psi=' |
39 | 39 | | self._bing = 'https://www.bing.com/AS/Suggestions?pt=&mkt=de-de&qry=<Q>&cp=0&css=0&cvid=1' |
40 | 40 | | self._millionshort = 'https://millionshort.com/api/suggestions?q=<Q>' |
41 | | - | self._zapmeta = 'https://www.zapmeta.com/jx?q=<Q>&limit=100&hl=1&r=0' |
| 41 | + | self._zapmeta = 'https://www.zapmeta.com/suggest?q=<Q>' |
42 | 42 | | self._searx = 'https://searx.be/autocompleter?q=<Q>' |
43 | 43 | | self._peekier = {'url': 'https://search.peekier.com/suggestions', 'payload': {'q': '<Q>', 'region': ''}, 'method': 'POST'} |
44 | 44 | | self._gigablast = 'http://gigablast.com/qs?rwp=0&lang=en&q=<Q>' |
| skipped 15 lines |
60 | 60 | | try: |
61 | 61 | | req = self.framework.request(url, method=method, data=data) |
62 | 62 | | except Exception as e: |
63 | | - | self.framework.error('Keywords connection error!') |
| 63 | + | self.framework.error('[KEYWORDS] connection error!') |
64 | 64 | | self.framework.print_exception() |
65 | | - | keys[source] = req or '' |
| 65 | + | keys[source] = req |
66 | 66 | | |
67 | 67 | | keys['yahoo'] = [x['k'] for x in keys['yahoo'].json().get('r', [])] |
68 | | - | google = json.loads(f"{keys['google'].text[5:]}")[0] |
69 | | - | keys['google'] = [re.sub(r"<b>|<\\/b>|</b>", '', x[0]) for x in google] |
| 68 | + | try: |
| 69 | + | google = json.loads(f"{keys['google'].text[5:]}")[0] |
| 70 | + | keys['google'] = [re.sub(r"<b>|<\\/b>|</b>", '', x[0]) for x in google] |
| 71 | + | except: |
| 72 | + | keys['google'] = [] |
70 | 73 | | keys['bing'] = re.findall(r'<span class="sa_tm_text">([^<]+)</span>', re.sub(r'<.?strong>', '', keys['bing'].text)) |
71 | | - | keys['millionshort'] = keys['millionshort'].json().get('suggestions', []) |
72 | | - | keys['zapmeta'] = [x[0] for x in keys['zapmeta'].json()] |
73 | | - | keys['searx'] = keys['searx'].json() |
| 74 | + | keys['zapmeta'] = [x[0] for x in keys['zapmeta'].json()] if hasattr(keys['zapmeta'], 'json') else [] |
| 75 | + | keys['millionshort'] = keys['millionshort'].json().get('suggestions', []) if hasattr(keys['millionshort'], 'json') else [] |
| 76 | + | try: |
| 77 | + | keys['searx'] = keys['searx'].json()[self.q] |
| 78 | + | except: |
| 79 | + | keys['searx'] = [] |
74 | 80 | | keys['peekier'] = keys['peekier'].json()['results'] |
75 | 81 | | keys['gigablast'] = re.findall(r'" >([^\n]+?)</td', keys['gigablast'].text) |
76 | 82 | | self._keys_category = keys |
| skipped 12 lines |