3

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.

pppery
  • 3,731
  • 22
  • 33
  • 46
matyas
  • 2,696
  • 23
  • 29
  • Have you tried NLTK to retrieve relevant search terms for a keyword e.g. through wordnet? – Jon Oct 22 '13 at 14:30
  • Yes NLTK is already a keyword source I am trying to to find further sources for my keyword analysis. – matyas Oct 22 '13 at 14:40
  • Of course there are other NLP projects. A good overview you can find here: http://opennlp.sourceforge.net/projects.html – Jon Oct 22 '13 at 15:14

1 Answers1

1

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"
            }
         }
      ]
   }
}