Created
March 4, 2015 19:05
-
-
Save daveamato/67a29588567effe6db5d to your computer and use it in GitHub Desktop.
ScrapingExample.py
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
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