From 952e57cf3e5df85e4a562aeca5a9ccd94f6f5e7b Mon Sep 17 00:00:00 2001 From: hubobel Date: Thu, 14 Feb 2019 17:27:45 +0100 Subject: [PATCH] V1.0 des SWR Abfragetools --- FilosophieTOsql.py | 53 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 FilosophieTOsql.py diff --git a/FilosophieTOsql.py b/FilosophieTOsql.py new file mode 100644 index 0000000..672adf8 --- /dev/null +++ b/FilosophieTOsql.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +import bs4 as bs +import requests +import time +import pymysql + +connection = pymysql.connect(db="hubobel", + user="hubobel", + passwd="polier2003", + host='10.0.1.59',charset='utf8') +cursor = connection.cursor() +try: + cursor.execute("""CREATE TABLE test ( + nr INTEGER, Filosophiefact TEXT)""") +except: + print ('weiter') +sql = "SELECT * FROM test ORDER BY nr DESC" +resp = cursor.execute(sql) + +ergebniss='' + +requests.packages.urllib3.disable_warnings() +sauce = requests.get('https://www.swr3.de/wraps/fun/filosofie/neu.php?id=11', verify=False) +soup = bs.BeautifulSoup(sauce.text, 'lxml') + +for i in soup.find_all('div'): + ergebniss=ergebniss+str(i) + +start=(ergebniss.find('href="/wraps/fun/filosofie/neu.php?id=12"> weiter >