mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Merge branch 'master' of https://github.com/unkn0w7n/calibre
This commit is contained in:
commit
c42fb69d66
@ -2,7 +2,8 @@ from calibre.web.feeds.news import BasicNewsRecipe, classes
|
|||||||
from calibre import browser
|
from calibre import browser
|
||||||
from html5_parser import parse
|
from html5_parser import parse
|
||||||
import json
|
import json
|
||||||
|
import random
|
||||||
|
import time
|
||||||
|
|
||||||
class Bloomberg(BasicNewsRecipe):
|
class Bloomberg(BasicNewsRecipe):
|
||||||
title = u'Bloomberg Businessweek'
|
title = u'Bloomberg Businessweek'
|
||||||
@ -14,7 +15,10 @@ class Bloomberg(BasicNewsRecipe):
|
|||||||
ignore_duplicate_articles = {'url'}
|
ignore_duplicate_articles = {'url'}
|
||||||
resolve_internal_links = True
|
resolve_internal_links = True
|
||||||
masthead_url = 'https://assets.bwbx.io/s3/javelin/public/hub/images/BW-Logo-Black-cc9035fbb3.svg'
|
masthead_url = 'https://assets.bwbx.io/s3/javelin/public/hub/images/BW-Logo-Black-cc9035fbb3.svg'
|
||||||
delay = 7 # seconds
|
|
||||||
|
# delay = 7 # seconds
|
||||||
|
# simultaneous_downloads = 1
|
||||||
|
|
||||||
extra_css = '''
|
extra_css = '''
|
||||||
#auth {font-size:small; font-weight:bold;}
|
#auth {font-size:small; font-weight:bold;}
|
||||||
#time, .chart {font-size:small;}
|
#time, .chart {font-size:small;}
|
||||||
@ -128,6 +132,9 @@ class Bloomberg(BasicNewsRecipe):
|
|||||||
|
|
||||||
for objects in body_data:
|
for objects in body_data:
|
||||||
|
|
||||||
|
pause = random.choice((0.5, 1, 1.25, 1.5))
|
||||||
|
time.sleep(pause)
|
||||||
|
|
||||||
if objects['type'] == 'media' and objects['subType'] == 'photo':
|
if objects['type'] == 'media' and objects['subType'] == 'photo':
|
||||||
body += '<p id="img"><img src="{}">'.format(objects['data']['photo']['src'])
|
body += '<p id="img"><img src="{}">'.format(objects['data']['photo']['src'])
|
||||||
body += '<span>' + objects['data']['photo']['caption'] + '</span></p>'
|
body += '<span>' + objects['data']['photo']['caption'] + '</span></p>'
|
||||||
|
@ -3,6 +3,8 @@ from calibre import browser
|
|||||||
from html5_parser import parse
|
from html5_parser import parse
|
||||||
from calibre.ptempfile import PersistentTemporaryFile
|
from calibre.ptempfile import PersistentTemporaryFile
|
||||||
import json
|
import json
|
||||||
|
import random
|
||||||
|
import time
|
||||||
|
|
||||||
class Bloomberg(BasicNewsRecipe):
|
class Bloomberg(BasicNewsRecipe):
|
||||||
title = u'Bloomberg'
|
title = u'Bloomberg'
|
||||||
@ -14,7 +16,8 @@ class Bloomberg(BasicNewsRecipe):
|
|||||||
ignore_duplicate_articles = {'url', 'title'}
|
ignore_duplicate_articles = {'url', 'title'}
|
||||||
resolve_internal_links = True
|
resolve_internal_links = True
|
||||||
|
|
||||||
delay = 7 # seconds
|
# delay = 7 # seconds
|
||||||
|
# simultaneous_downloads = 1
|
||||||
|
|
||||||
extra_css = '''
|
extra_css = '''
|
||||||
#auth {font-size:small; font-weight:bold;}
|
#auth {font-size:small; font-weight:bold;}
|
||||||
@ -122,6 +125,9 @@ class Bloomberg(BasicNewsRecipe):
|
|||||||
|
|
||||||
for objects in body_data:
|
for objects in body_data:
|
||||||
|
|
||||||
|
pause = random.choice((0.5, 1, 1.25, 1.5))
|
||||||
|
time.sleep(pause)
|
||||||
|
|
||||||
if objects['type'] == 'media' and objects['subType'] == 'photo':
|
if objects['type'] == 'media' and objects['subType'] == 'photo':
|
||||||
body += '<p id="img"><img src="{}">'.format(objects['data']['photo']['src'])
|
body += '<p id="img"><img src="{}">'.format(objects['data']['photo']['src'])
|
||||||
body += '<span>' + objects['data']['photo']['caption'] + '</span></p>'
|
body += '<span>' + objects['data']['photo']['caption'] + '</span></p>'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user