Skip to content

Instantly share code, notes, and snippets.

@vivosmith
Created September 28, 2016 17:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vivosmith/c5cbb511f9321f82b227730a9ae616ac to your computer and use it in GitHub Desktop.
Save vivosmith/c5cbb511f9321f82b227730a9ae616ac to your computer and use it in GitHub Desktop.
A way to search all articles on ehow
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