mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
pep8
This commit is contained in:
parent
13f9c072d2
commit
e00e213ba5
@ -1,10 +1,10 @@
|
|||||||
import json
|
import json
|
||||||
import random
|
import random
|
||||||
import time
|
import time
|
||||||
|
from collections import defaultdict
|
||||||
|
|
||||||
from calibre.web.feeds.news import BasicNewsRecipe, classes, prefixed_classes
|
from calibre.web.feeds.news import BasicNewsRecipe, classes, prefixed_classes
|
||||||
from html5_parser import parse
|
from html5_parser import parse
|
||||||
from collections import defaultdict
|
|
||||||
|
|
||||||
|
|
||||||
def get_contents(x):
|
def get_contents(x):
|
||||||
@ -119,7 +119,6 @@ class Bloomberg(BasicNewsRecipe):
|
|||||||
if h3 and h3.text:
|
if h3 and h3.text:
|
||||||
sec = self.tag_to_string(h3)
|
sec = self.tag_to_string(h3)
|
||||||
self.log(sec)
|
self.log(sec)
|
||||||
articles = []
|
|
||||||
a = div.find(**prefixed_classes('MagazinePageMagazineArchive_storyLink__'))
|
a = div.find(**prefixed_classes('MagazinePageMagazineArchive_storyLink__'))
|
||||||
url = a['href']
|
url = a['href']
|
||||||
if url.startswith('http') is False:
|
if url.startswith('http') is False:
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
from urllib.parse import quote
|
from urllib.parse import quote
|
||||||
|
|
||||||
|
from calibre.ebooks.BeautifulSoup import BeautifulSoup
|
||||||
from calibre.scraper.simple import read_url
|
from calibre.scraper.simple import read_url
|
||||||
from calibre.web.feeds.news import BasicNewsRecipe, prefixed_classes
|
from calibre.web.feeds.news import BasicNewsRecipe, prefixed_classes
|
||||||
|
|
||||||
|
|
||||||
def resize(x):
|
def resize(x):
|
||||||
if 'resize' in x:
|
if 'resize' in x:
|
||||||
return x.split('&resize')[0] + '&resize=600'
|
return x.split('&resize')[0] + '&resize=600'
|
||||||
@ -75,7 +78,7 @@ class times(BasicNewsRecipe):
|
|||||||
for a in soup.findAll('a', href=True):
|
for a in soup.findAll('a', href=True):
|
||||||
a['href'] = 'http' + a['href'].split('http')[-1]
|
a['href'] = 'http' + a['href'].split('http')[-1]
|
||||||
div = soup.findAll(attrs={'style': lambda x: x and x.startswith(
|
div = soup.findAll(attrs={'style': lambda x: x and x.startswith(
|
||||||
'color:rgb(51, 51, 51);font-family:TimesDigitalW04-Regular'
|
'color:rgb(51, 51, 51);font-family:TimesDigitalW04-Regular'
|
||||||
)})
|
)})
|
||||||
for p in div:
|
for p in div:
|
||||||
p.name = 'p'
|
p.name = 'p'
|
||||||
@ -101,7 +104,7 @@ class times(BasicNewsRecipe):
|
|||||||
|
|
||||||
feeds = []
|
feeds = []
|
||||||
when = oldest_article*24
|
when = oldest_article*24
|
||||||
index = 'https://www.thetimes.com/'
|
index = 'https://www.thetimes.com/'
|
||||||
sections = [
|
sections = [
|
||||||
'politics', 'world', 'uk/politics', 'uk/scotland', 'uk', 'comment', 'business-money', 'sport',
|
'politics', 'world', 'uk/politics', 'uk/scotland', 'uk', 'comment', 'business-money', 'sport',
|
||||||
'life-style', 'culture', 'magazine', 'travel', 'sunday-times', 'edition', 'article'
|
'life-style', 'culture', 'magazine', 'travel', 'sunday-times', 'edition', 'article'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user