Skip to content

Instantly share code, notes, and snippets.

@daveamato
Created March 4, 2015 19:05
Show Gist options
  • Save daveamato/67a29588567effe6db5d to your computer and use it in GitHub Desktop.
Save daveamato/67a29588567effe6db5d to your computer and use it in GitHub Desktop.
ScrapingExample.py
import ui
import requests
import clipboard
from console import hud_alert
from bs4 import BeautifulSoup
def start_scrape(sender):
v = sender.superview
#hud_alert('enter a valid URL')
surl = v['surl'].text
re = requests.get(surl)
data = re.text
soup = BeautifulSoup(data)
for link in soup.find_all('a'):
v['consout'].text += link.get('href') + '\n\n'
print(link.get('href'))
def copy_action(sender):
clipboard.set(sender.superview['label1'].text)
hud_alert('Copied')
v = ui.load_view('ScrapingExample')
v.present()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment