Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Matteo Delfavero jan.2019
- # honfoglalo.hu
- from PIL import Image
- from bs4 import BeautifulSoup
- import requests
- import pytesseract
- import pyautogui
- pytesseract.pytesseract.tesseract_cmd = r'<full_path_to_your_tesseract_executable>'
- # Example tesseract_cmd = r'C:\Program Files (x86)\Tesseract-OCR\tesseract'
- def OCRimage():
- # (x, y, width, height)
- pos = (190, 700, 950, 230)
- return pytesseract.image_to_string(pyautogui.screenshot(region=(pos)))
- def main(keyword):
- print(keyword + "\n")
- google_search = "https://www.google.co.in/search?client=ubuntu&channel=fs&biw=748&bih=875&source=hp&ei=Ugc4XOStLc7CwQK4jbmACg&q=" + keyword
- url = BeautifulSoup(requests.get(google_search).text, "html.parser").findAll('span', {"class":"st"})
- for u in url:
- print(u.text)
- break
- if __name__ == '__main__':
- main(OCRimage())
Add Comment
Please, Sign In to add comment