Skip to content

Instantly share code, notes, and snippets.

@chiaoyaaaaa
Last active September 12, 2020 13:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chiaoyaaaaa/3d6a819cf3edbdd7f0e305c42b822b37 to your computer and use it in GitHub Desktop.
Save chiaoyaaaaa/3d6a819cf3edbdd7f0e305c42b822b37 to your computer and use it in GitHub Desktop.
catch fb all post's number of likes
# 建立一個空的list
like = []
# 抓取每一篇貼文的按讚數
# class name可能會修改,需要定期偵錯!
for ii in frames:
thumb = ii.find('span',class_="gpro0wi8 pcp91wgn")
# 有些貼文沒有按讚數,所以抓下來的東西是None,因此直接append 0
if(thumb == None):
like.append('0')
else:
like.append(thumb.text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment