-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathutil.py
More file actions
32 lines (25 loc) · 783 Bytes
/
Copy pathutil.py
File metadata and controls
32 lines (25 loc) · 783 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from bs4 import BeautifulSoup
def get_html_page(browser):
data = browser.find_element_by_tag_name('body')
html = data.get_attribute('innerHTML')
return BeautifulSoup(html, 'html.parser')
def get_url_imgs(imgs):
imgs_urls = []
for i in imgs:
if 'url' in i:
aux = i.split('url("')
x = aux[1].split('")')
imgs_urls.append(x[0])
img_urls_done = []
for i in range(3, len(imgs_urls)):
img_urls_done.append(imgs_urls[i])
return img_urls_done
def get_captcha_word(phrase):
words_list = phrase.split()
captcha_text_pt = words_list[-1].strip()
if captcha_text_pt == 'bicicleta':
return 'bicycle'
if captcha_text_pt == 'barco':
return 'boat'
else:
return None