Created
September 28, 2016 17:16
-
-
Save vivosmith/c5cbb511f9321f82b227730a9ae616ac to your computer and use it in GitHub Desktop.
A way to search all articles on ehow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from urllib.request import urlopen | |
from bs4 import BeautifulSoup | |
import tkinter | |
from tkinter import * | |
class ehow: | |
ehow_website=Tk() | |
text=Text(ehow_website) | |
def website(): | |
link_collector=[] | |
url = urlopen("http://www.ehow.com").read() | |
soup = BeautifulSoup(url,"html.parser") | |
for line in soup.find_all('a'): | |
link_collector=line.get('href') | |
return link_collector | |
def individual_links(links): | |
coldstorage=[] | |
individual_links.cold_storage=coldstorage | |
for link in links: | |
url_open=urlopen("http://www.ehow.com"+link).read() | |
soup2=BeautifulSoup(url_open,"html.parser") | |
for linker in soup2.find_all('a'): | |
coldstorage=linker | |
for linked in individual_links.cold_storage: | |
text.insert(linked) | |
text.pack() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment