Python Web Extraction strip append bs4 beauitfulsoup

Question:

How can I extract all the company names in the example? The first three return without an issue, but when then the issue comes along.

import requests
from bs4 import BeautifulSoup
r = requests.get('https://remote.co/remote-jobs/developer/')
s = BeautifulSoup(r.text,'lxml')
jobs = s.find('div',{'class':'card bg-white m-0'})
jobs_listed = jobs.select('p',{'class':'m-0'})
empty = []
for j in jobs_listed:
    company_name = j.find_next_sibling('p', {'class':'m-0 text-secondary'})
    less = j.find_next_sibling()
    if company_name != None:
        company_title = company_name.text.strip()
        print(company_title)
        empty.append(company_title)

Asked By: jhgjhgkk

||

Answers:

I managed to solve your problem :

from bs4 import BeautifulSoup
import requests

url = "https://remote.co/remote-jobs/developer/"
html_text = requests.get(url).text
soup = BeautifulSoup(html_text, "lxml")
allcompany_information = soup.find_all("p",class_="m-0 text-secondary")
for name_company in allcompany_information:
    print(name_company.contents[0].text.replace("|","").strip())
Answered By: Bored Nerd