-2
我想在Instagram中提取隨機網頁的追隨者。我試圖將python與Beautiful Soup結合使用。Instagram Web抓取追隨者
不過我還沒有收到在網頁的任何信息,在那裏我可以訪問
def get_user_info(user_name):
url = "https://www.instagram.com/" + user_name + "/?__a=1"
try:
r = requests.get(url)
except requests.exceptions.ConnectionError:
print ('Seems like dns lookup failed..')
time.sleep(60)
return None
if r.status_code != 200:
print ('User: ' + user_name + ' status code: ' + str(r.status_code))
print (r)
return None
info = json.loads(r.text)
return info['user']
get_user_info("wernergruener")
如前所述我不明白的頁面的追隨者。我怎麼能這樣做?
乾杯, 安迪
我試過在'wernergruener'中搜索instagram,然後空着。那是確切的名字嗎? –