【发布时间】:2019-05-22 15:05:32
【问题描述】:
我得到了一个用于抓取 Instagram 数据的代码。这是刮掉追随者,追随者和帖子,但我仍然需要在帖子上刮点赞。有没有办法在没有 API 的情况下从 instagram 上刮点赞?
这是scrape的代码,我还需要在这里刮点赞。
import requests
import urllib.request
import urllib.parse
import urllib.error
from bs4 import BeautifulSoup
import ssl
class Insta_Info_Scraper:
def getinfo(self, url):
html = urllib.request.urlopen(url, context=self.ctx).read()
soup = BeautifulSoup(html, 'html.parser')
data = soup.find_all('meta', attrs={'property': 'og:description'
})
text = data[0].get('content').split()
user = '%s %s %s' % (text[-3], text[-2], text[-1])
followers = text[0]
following = text[2]
posts = text[4]
info={}
info["User"] = user
info["Followers"] = followers
info["Following"] = following
info["Posts"] = posts
self.info_arr.append(info)
【问题讨论】:
-
你能提供任何示例网址吗?
标签: python beautifulsoup instagram