pythondelicious-api

How To Access Delicious API to Retrieve Google Related Keywords


I am looking for a way to retrieve relevant keywords for a search term, and was thinking about using the the delicious API for this goal:

I found some websites which used the delicious API for this purpose that are also mentioned in my quoted stackoverflow question:

How to retrieve delicious related tags For example: http://hublog.hubmed.org/archives/001049.html

I went through the delicious API but did not find any function that could give me the result that I wanted.

Does delicious.com still offer this functionality? And if so how could I use it with Python?

I was trying to retrieve some data with this Python wrapper class: https://github.com/mudge/python-delicious but it also seems to have lack of functionality to retrieve related keywords.


Solution

  • Here is a simple way to find related keywords using Python:

    import requests
    import xmltodict
    import json
    import re
    
    KEYWORD = 'best icecream'
    
    res     = requests.get('https://google.com/complete/search?output=toolbar&gl=eg&q={}'.format({re.sub("\s", "_", KEYWORD)}))
    obj     = xmltodict.parse(res.text)
    json    = json.dumps(obj)
    
    print(json)
    

    Result preview:

    {
       "toplevel":{
          "CompleteSuggestion":[
             {
                "suggestion":{
                   "@data":"best ice cream scoop"
                }
             },
             {
                "suggestion":{
                   "@data":"best ice cream places"
                }
             },
             {
                "suggestion":{
                   "@data":"best ice cream places near me"
                }
             },
             {
                "suggestion":{
                   "@data":"best ice cream in india"
                }
             },
             {
                "suggestion":{
                   "@data":"best ice cream in rome"
                }
             },
             {
                "suggestion":{
                   "@data":"best keto ice cream"
                }
             },
             {
                "suggestion":{
                   "@data":"best vanilla ice cream"
                }
             },
             {
                "suggestion":{
                   "@data":"best ice cream"
                }
             },
             {
                "suggestion":{
                   "@data":"best ice cream maker"
                }
             },
             {
                "suggestion":{
                   "@data":"best ice cream brands"
                }
             }
          ]
       }
    }