Exemplo n.º 1
0
 def test_ddg(self):
     result = query('meat')
     string = ""
     related = result.related
     print('')
     for r in related:
         string += '\n----------------\n'
         string += r.url + "\n"
         string += r.text + "\n"
         string += '\n----------------\n'
     self.assertNotEquals("", string)
Exemplo n.º 2
0
 def test_ddg(self):
     result = query('meat')
     string = ""
     related = result.related
     print('')
     for r in related:
         string += '\n----------------\n'
         string += r.url + "\n"
         string += r.text + "\n"
         string += '\n----------------\n'
     self.assertNotEquals("", string)
Exemplo n.º 3
0
def get_websites_from_duckduckgo(search_query):
    """
    Called when no search results are found locally.
    Returns related results from DuckDuckGo's API
    """
    websites = []
    response = query(search_query,useragent='RoblySearch')
    related = response.related
    for r in related:
        try:
            w = Website(r.url,r.text,h1s=[],links=[],images=[],non_html=[],description=r.text,
                        keywords=[],robots_index=True)
            websites.append(w)
        except:
            pass
    return websites
Exemplo n.º 4
0
def get_websites_from_duckduckgo(search_query):
    """
    Called when no search results are found locally.
    Returns related results from DuckDuckGo's API
    """
    websites = []
    response = query(search_query, useragent='RoblySearch')
    related = response.related
    for r in related:
        try:
            w = Website(r.url,
                        r.text,
                        h1s=[],
                        links=[],
                        images=[],
                        non_html=[],
                        description=r.text,
                        keywords=[],
                        robots_index=True)
            websites.append(w)
        except:
            pass
    return websites