I want to access my publicly available LinkedIn page. On my local machine, following code works:
import requests
url = "http://de.linkedin.com/pub/ankush-shah/73/9/982"
html = requests.get(url).text
print html
And it gives the correct html of my profile.
But when I execute the same code on my Heroku server, I (guess) am redirected to somewhere and gets this html.
Also, when I try with urllib2 on the heroku server:
import urllib2
url = "http://de.linkedin.com/pub/ankush-shah/73/9/982"
u = urllib2.urlopen(url)
This throws an urllib2.HTTPError: HTTP Error 999: Request denied
As I am using virtualenv, all the libraries on my local machine are exactly similar to the one installed on heroku server. Does LinkedIn blocks HTTP requests from servers like Heroku? Any help/suggestions would be appreciated.
HTTP API exampleSet LINKEDIN_API_KEY and LINKEDIN_API_SECRET, configure your app to redirect to http://localhost:8080/code, then execute: http_api.py. Visit http://localhost:8080 in your browser, curl or similar. A tab in your browser will open up, give LinkedIn permission there.
Log into your LinkedIn accountselenium import webdriver import BeautifulSoup time # Creating a webdriver instance webdriver. Chrome("Enter-Location-Of-Your-Web-Driver") # This instance will be used to log into LinkedIn # Opening linkedIn's login page. ("https://linkedin.com/uas/login") # waiting for the page to load.
Captain Data allows you to scrape LinkedIn and extract data from almost any website and especially LinkedIn or LinkedIn Sales Navigator. The tool offers Sales and Marketing teams ready-to-use workflows to automate their prospecting: find leads, enrich them, address them in a hyper-personalized manner.
As mention here, LinkedIn do not allow direct access. They have blacklisted Heroku's IP address and the only way to access the data is to use their APIs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With