bs4 api changed
This commit is contained in:
parent
dc82d87d67
commit
eec4631986
@ -35,7 +35,8 @@ def scrape_feed(feed_url):
|
|||||||
|
|
||||||
meta = {}
|
meta = {}
|
||||||
meta['title'] = soup.title.text
|
meta['title'] = soup.title.text
|
||||||
meta['html_url'] = soup.find("link", href="").text
|
#meta['html_url'] = soup.find("link", href="").text
|
||||||
|
meta['html_url'] = soup.find("link", string=re.compile(".")).text
|
||||||
meta['html_url'] = meta['html_url'].replace('http://', 'https://')
|
meta['html_url'] = meta['html_url'].replace('http://', 'https://')
|
||||||
meta['description'] = soup.description.text
|
meta['description'] = soup.description.text
|
||||||
|
|
||||||
@ -76,7 +77,7 @@ def scrape_zombie_knight(soup):
|
|||||||
entry_dict['title'] = entry.title.text
|
entry_dict['title'] = entry.title.text
|
||||||
entry_dict['link'] = entry.find("link", rel='alternate').get('href')
|
entry_dict['link'] = entry.find("link", rel='alternate').get('href')
|
||||||
date = entry.updated.text
|
date = entry.updated.text
|
||||||
date = "".join(re.search("(.*)\.\d{3}(.\d{2}):(\d{2})", date).groups())
|
date = "".join(re.search(r"(.*)\.\d{3}(.\d{2}):(\d{2})", date).groups())
|
||||||
date = time.strptime(date, '%Y-%m-%dT%H:%M:%S%z')
|
date = time.strptime(date, '%Y-%m-%dT%H:%M:%S%z')
|
||||||
entry_dict['date'] = time.strftime('%Y-%m-%d', date)
|
entry_dict['date'] = time.strftime('%Y-%m-%d', date)
|
||||||
entry_dict['description'] = entry.content.text[:200]
|
entry_dict['description'] = entry.content.text[:200]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user