Created
September 12, 2020 13:52
-
-
Save chiaoyaaaaa/4271ff90f5ee87d76f78c0ecd275e1db to your computer and use it in GitHub Desktop.
catch fb all post's number of comments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 建立一個空的list | |
comment_nums = [] | |
# 抓取每一篇貼文的留言數 | |
# class name可能會修改,需要定期偵錯! | |
for ii in frames: | |
read = ii.find('span',class_="oi732d6d ik7dh3pa d2edcug0 hpfvmrgz qv66sw1b c1et5uql a8c37x1j muag1w35 enqfppq2 jq4qci2q a3bd9o3v knj5qynh m9osqain") | |
# 有些貼文沒有留言數,所以抓下來的東西是None,因此直接append 0 | |
if(read == None): | |
comment_nums.append('0則') | |
else: | |
comment_nums.append(read.text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment