Hi , to get some persons or companies social media URLs

we can do in two ways

1)scrape their portfolio website or company home page after scarping get that results in an array and search for facebook.com, if find out that result

2) using Microsoft congnitive services Python API

https://www.microsoft.com/cognitive-services

subscribe to Bing Search -Free and get the subscription key

https://www.microsoft.com/cognitive-services/en-us/subscriptions?displayClass=subscription-free-trials

Later, in your python IDE use the fallowing test code with python 2.x code

I am searching Kim kardashian facebook linksand gonna print them

import httplib, urllib, base64

headers = {
# Request headers
'Ocp-Apim-Subscription-Key': 'XXXXXXXXXXXX197245axxxxxx41e'
}

params = urllib.urlencode({
# Request parameters

'q': 'kim kardashian facebook',
'count': '10', # no.of results you want
'offset': '0', # no.of results you need to skip before printing out
'mkt': 'en-us', # which country results you wanna search,
# sometimes u wanna search bing UK or bing India or bing Aus
'safesearch': 'Moderate',
})

try:
conn = httplib.HTTPSConnection('api.cognitive.microsoft.com')
conn.request("GET", "/bing/v5.0/search?%s" % params, "{body}", headers)
response = conn.getresponse()
data = response.read()

#here comes our code
#output data is in string format, split it using white spaces
#and make it into array
#then loop the array

datax=data.split(" ")
for xy in datax:
#if the array element conatians facebook.com and not bing
if "facebook.com" in xy and "bing" not in xy:
#then print it to '\/' with '/'
print xy.replace("\/","/")
conn.close()
except Exception as e:
print("[Errno {0}] {1}".format(e.errno, e.strerror))

)
Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade