Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is a python project I am working on. How would I get rid of the hrefs for twitter? I am using python and beautiful

This is a python project I am working on. How would I get rid of the hrefs for twitter? I am using python and beautiful soup to scrape a website but I only want the links for the articles not a twitter link to show up in my array. import requests from bs4 import BeautifulSoup, SoupStrainer URL = 'https://www.usnpl.com/search/state?state=MI#section-D' page = requests.get(URL) soup = BeautifulSoup(page.content, 'html.parser') links = SoupStrainer('a') #Find a way to filter out facebook classes with i tag websites = soup.find_all(class_="w-10" ) a= [] for tag in websites: tdTags = tag.find_all("a") if tdTags: a.append(tdTags) for x in a: print(x)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design For Mere Mortals

Authors: Michael J Hernandez

4th Edition

978-0136788041

More Books

Students also viewed these Databases questions

Question

=+ (c) Show that if & is countable, then f(. ) is countable.

Answered: 1 week ago