mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
8d4a502620
commit
062f943b4c
@ -9,7 +9,6 @@ discovermagazine.com
|
|||||||
|
|
||||||
import re
|
import re
|
||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
from calibre.ebooks.BeautifulSoup import BeautifulSoup, Tag
|
|
||||||
|
|
||||||
class DiscoverMagazine(BasicNewsRecipe):
|
class DiscoverMagazine(BasicNewsRecipe):
|
||||||
|
|
||||||
@ -38,7 +37,6 @@ class DiscoverMagazine(BasicNewsRecipe):
|
|||||||
pager = soup.find('span',attrs={'class':'next'})
|
pager = soup.find('span',attrs={'class':'next'})
|
||||||
if pager:
|
if pager:
|
||||||
nexturl = pager.a['href']
|
nexturl = pager.a['href']
|
||||||
print 'nexturl is: ', nexturl
|
|
||||||
soup2 = self.index_to_soup(nexturl)
|
soup2 = self.index_to_soup(nexturl)
|
||||||
texttag = soup2.find('div', attrs={'class':'articlebody'})
|
texttag = soup2.find('div', attrs={'class':'articlebody'})
|
||||||
newpos = len(texttag.contents)
|
newpos = len(texttag.contents)
|
||||||
@ -48,7 +46,6 @@ class DiscoverMagazine(BasicNewsRecipe):
|
|||||||
|
|
||||||
def preprocess_html(self, soup):
|
def preprocess_html(self, soup):
|
||||||
mtag = '<meta http-equiv="Content-Language" content="en-US"/>\n<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>'
|
mtag = '<meta http-equiv="Content-Language" content="en-US"/>\n<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>'
|
||||||
print 'soup1 is: ', soup
|
|
||||||
soup.head.insert(0,mtag)
|
soup.head.insert(0,mtag)
|
||||||
self.append_page(soup, soup.body, 3)
|
self.append_page(soup, soup.body, 3)
|
||||||
pager = soup.find('div',attrs={'class':'listingBar'})
|
pager = soup.find('div',attrs={'class':'listingBar'})
|
||||||
@ -67,7 +64,6 @@ class DiscoverMagazine(BasicNewsRecipe):
|
|||||||
tag.extract()
|
tag.extract()
|
||||||
for tag in soup.findAll('br'):
|
for tag in soup.findAll('br'):
|
||||||
tag.extract()
|
tag.extract()
|
||||||
print 'soup2 is: ', soup
|
|
||||||
return soup
|
return soup
|
||||||
|
|
||||||
feeds = [
|
feeds = [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user