test
This commit is contained in:
parent
0a46b1c356
commit
57aa0cfa92
@ -1,7 +1,6 @@
|
|||||||
|
|
||||||
import urllib
|
|
||||||
from xml.dom.minidom import parseString
|
|
||||||
import requests
|
import requests
|
||||||
|
import lxml
|
||||||
|
|
||||||
from sopel import plugin
|
from sopel import plugin
|
||||||
|
|
||||||
@ -19,13 +18,10 @@ def upper(bot, trigger, comrun):
|
|||||||
|
|
||||||
def fetch_string():
|
def fetch_string():
|
||||||
content_url = 'http://developerexcuses.com'
|
content_url = 'http://developerexcuses.com'
|
||||||
content_page = requests.get(content_url, headers={'Accept': 'text/plain'})
|
response = requests.get(content_url)
|
||||||
fetched_str = content_page.content
|
tree = lxml.html.fromstring(response.text)
|
||||||
return fetched_str
|
title_elem = tree.xpath('/html/body/div[1]/center/a')[0]
|
||||||
|
fetched_str = str(title_elem)
|
||||||
|
|
||||||
def fetch_stringsd():
|
|
||||||
content_url = 'http://developerexcuses.com'
|
|
||||||
content_page = urllib.request.urlopen(content_url).read()
|
|
||||||
fetched_str = parseString(content_page.replace('&', '')).getElementsByTagName('body')[0].getElementsByTagName('div')[0].getElementsByTagName('center')[0].getElementsByTagName('a')[0].childNodes[0].nodeValue
|
|
||||||
return fetched_str
|
return fetched_str
|
||||||
|
# .wrapper > center:nth-child(1) > a:nth-child(1)
|
||||||
|
# /html/body/div[1]/center/a
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user