Dec-05-2020, 11:58 PM
I'm scraping facebook groups using Facebook_Scraper but I am experiencing issues with it.
Here's the code I have:
Here's the code I have:
import operator
from facebook_scraper import get_posts
from wordlist import words
title_list = []
for submission in get_posts(group = "nintendo", pages=1):
titles = str(submission['text'][:10])
titles = titles.replace("\n", " ")
title_list.append(titles)
word_list = [word for line in title_list for word in line.split()]
filtered_words1 = [word for word in word_list if word in words]
print(filtered_words1)The file wordlist.py contains only the following:words = ["Python"]Here's the following error I receive:
Error:Traceback (most recent call last):
File "main.py", line 15, in <module>
filtered_words1 = [word for word in word_list if word in words]
NameError: name 'word_list' is not definedI'm not sure why it's throwing the error. word_list is defined clearly enough.
