Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from bs4 import BeautifulSoup
- import requests, smtplib, lxml
- from email.mime.multipart import MIMEMultipart
- from email.mime.text import MIMEText
- source_mmarocks = requests.get('http://mmarocks.pl').text
- soup_mmarocks = BeautifulSoup(source_mmarocks, 'lxml')
- source_grappler = requests.get('http://grapplerinfo.pl').text
- soup_grappler = BeautifulSoup(source_grappler, 'lxml')
- source_lowking = requests.get('http://lowking.pl').text
- soup_lowking = BeautifulSoup(source_lowking, 'lxml')
- def mmarocks():
- print('==========================MMAROCKS====================')
- index = 0
- limit = 10
- for hd in soup_mmarocks.find_all('div', class_="td-module-thumb"):
- header = hd.a['title']
- print(header)
- header_link = hd.a['href']
- print(header_link)
- print()
- index += 1
- if index == limit:
- print()
- print()
- break
- def grappler():
- print('========================GRAPPLER======================')
- for article in soup_grappler.find_all('article'):
- try:
- main_headline = article.find('div', class_='entry').h3.a.text
- print(main_headline)
- except:
- break
- main_link = article.find('div', class_='entry').h3.a['href']
- print(main_link)
- print()
- def lowking():
- print('========================LOWKING======================')
- main_news = soup_lowking.find('div', class_='main-text').h1.text
- print(main_news)
- main_link = soup_lowking.find('div', class_='main-story').a['href']
- print(main_link)
- print()
- def lowking1():
- limit = 10
- index = 0
- for sub_art in soup_lowking.find_all('div', class_='sub-story'):
- sub_head = sub_art.h2.text
- print(sub_head)
- sub_link = sub_art.a['href']
- print(sub_link)
- print()
- index += 1
- if index == limit:
- break
- def lowking2():
- limit = 10
- index = 0
- for artykul in soup_lowking.find_all('div', class_='archive-text'):
- regular_news = artykul.h2.text
- print(regular_news)
- tresc = artykul.p.text
- print(tresc)
- link = artykul.h2.a['href']
- print(link)
- print()
- index += 1
- if index == limit:
- break
- def gotowymail():
- return mmarocks(),grappler(), lowking(), lowking1(), lowking2()
- nowygotowymail = gotowymail()
- f = open("prasowka.txt","w+")
- f.write(nowygotowymail)
- f.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement