pnbt / youtube-explore

Finding YouTube's top recommendations from any query
211 stars 54 forks source link

Trouble w/ BeautifulSoup #5

Open bsullins opened 6 years ago

bsullins commented 6 years ago

On a fresh install of macOS Sierra 10.12.6 and had a hell of a time getting setup. Trying to install beautiful soup I had to download/extract the tarball then run setup.py

Now I'm seeing this error, which leads me to believe it's not setup right. Any help?

imac:youtube-explore ben$ python2.7 follow-youtube-recommendations.py --query="global warming,vaccines,nasa" --searches=4 --branch=4 --depth=4 --name="science"
INFO We will NOT be printing keys - False
Running, will save the resulting json to:results/science-2018-04-13.json
Location = None Language = None
Searching for global warming
Searching URL: https://www.youtube.com/results?sp=EgIQAQ%253D%253D&q=global%20warming
Traceback (most recent call last):
  File "follow-youtube-recommendations.py", line 388, in <module>
    sys.exit(main())
  File "follow-youtube-recommendations.py", line 383, in main
    compare_keywords(args.query, args.searches, args.branch, args.depth, args.name, args.gl, args.language, args.recent, args.loopok)
  File "follow-youtube-recommendations.py", line 352, in compare_keywords
    depth=depth)
  File "follow-youtube-recommendations.py", line 244, in go_deeper_from
    all_recos = self.compute_all_recommendations_from_search(search_term, search_results, branching, depth)
  File "follow-youtube-recommendations.py", line 225, in compute_all_recommendations_from_search
    search_results = self.get_search_results(search_terms, search_results)
  File "follow-youtube-recommendations.py", line 89, in get_search_results
    soup = BeautifulSoup(html, "lxml")
  File "/Library/Python/2.7/site-packages/bs4/__init__.py", line 152, in __init__
    % ",".join(features))
ValueError: Couldn't find a tree builder with the features you requested: lxml. Do you need to install a parser library?
imac:youtube-explore ben$ 
ageitgey commented 6 years ago

It seems like you don't have lxml installed.

I would try this:

# Install homebrew for Mac
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

# Install libxml2 with homebrew
brew install libxml2

# Install lxml
pip install lxml