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 lxml
|
||||
|
||||
from sopel import plugin
|
||||
|
||||
@ -19,13 +18,10 @@ def upper(bot, trigger, comrun):
|
||||
|
||||
def fetch_string():
|
||||
content_url = 'http://developerexcuses.com'
|
||||
content_page = requests.get(content_url, headers={'Accept': 'text/plain'})
|
||||
fetched_str = content_page.content
|
||||
return fetched_str
|
||||
|
||||
|
||||
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
|
||||
response = requests.get(content_url)
|
||||
tree = lxml.html.fromstring(response.text)
|
||||
title_elem = tree.xpath('/html/body/div[1]/center/a')[0]
|
||||
fetched_str = str(title_elem)
|
||||
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