Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests
- from bs4 import BeautifulSoup
- import praw
- import webbrowser
- import time
- def parse_data(keyword):
- url = ('http://overwatch.gamepedia.com/{0}'.format(keyword))
- raw = requests.get(url)
- soup = BeautifulSoup(raw.text, 'html.parser')
- bio = soup.find('table', 'infoboxtable')
- player = {}
- for weapon in soup.select('.ability_details'):
- name = weapon.find('span').text
- player[name] = {}
- for div in weapon.select('.infoboxtable td > div'):
- stat = div.text.strip().encode('utf-8')
- value = div.find_parent('td').find_next('td').text.strip().encode('utf-8')
- player[name][stat] = value
- playerlist = []
- for key, value in player.items():
- temp = [key,value]
- playerlist.append(temp)
- return playerlist
- def scan_reddit():
- r = praw.Reddit(user_agent='OW WikiHelp developed (by /u/Superf1cial)',
- client_id='', client_secret="",
- username='NAME', password='PW')
- already_done = set()
- keywords= ['Genji', 'McCree', 'Pharah', 'Reaper', 'Tracer', 'Bastion', 'Hanzo', 'Junkrat',
- 'Mei', 'Torbjörn', 'Widowmaker', 'D.Va', 'Reinhardt', 'Roadhog', 'Winston', 'Zarya',
- 'Ana', 'Lucio', 'Mercy', 'Symettra', 'Zenyatta']
- subreddit = r.get_subreddit('competitiveoverwatch')
- for c in praw.helpers.comment_stream(r, subreddit):
- has_word = any(string in c.body for string in keywords)
- if c.id not in already_done and has_word:
Add Comment
Please, Sign In to add comment