Search code examples
pythonandroidbeautifulsoupchaquopy

Implementing BeautifulSoup to Android Studio with chaquopy


I'm currently making a web scraping app using Android Studio with BeautifulSoup. How do I implement

from bs4 import BeautifulSoup

into Android Studio as I would in Python?

My build.gradle is

python {
        buildPython "C:/Python38/python.exe"
        pip{
            install "bs4"
            install "beautifulsoup4"
            install "requests"
        }
    }

and my imports in Python is

from bs4 import BeautifulSoup
import requests

Solution

  • Instead of using

    soup = BeautifulSoup(html_text, 'lxml')
    

    I used

    soup = BeautifulSoup(html_text, 'html.parser')
    

    in the Python file and it seemed to do the job.