Search code examples
pythondjangopython-2.7oauth-2.0linkedin-api

Linkedin API, Company Updates, Select Language


Hi i am trying to get company updates from linkedin api. But the problem is i am getting company updates in all languages. I only want to get english updates. My question is how do i get only english updates. Below is my code

url = "https://api.linkedin.com/v1/companies/"+CompanyLinkedinID+"/updates?event-type=status-update&oauth2_access_token="+user.LinkedinOauth2Token
lp = urllib2.urlopen(url)
doc = etree.parse(lp)
lp.close()

After these four lines of code i just parse these updates. How do i set the parameter to get only English updates.


Solution

  • I was not able to find any satisfactory answer. SO below is the approach i took. Once i receive the update i used python library "guess_language" to detect which language the update belongs to. This library works on trigram https://bitbucket.org/spirit/guess_language It gave satisfactory results.