Bloomberg

This commit is contained in:
unkn0w7n 2023-08-26 13:17:01 +05:30
parent 37e21f78ee
commit 04638feeb9
2 changed files with 8 additions and 6 deletions

View File

@ -176,15 +176,16 @@ class Bloomberg(BasicNewsRecipe):
caption = '<span class="cap">' + data['lede']['alt'] + '</span>' caption = '<span class="cap">' + data['lede']['alt'] + '</span>'
if m: if m:
time.sleep(10) time.sleep(5)
body = data['body'] body = data['body']
else: else:
body = '' body = ''
body_data = data['body']['content'] body_data = data['body']['content']
for x in body_data: for x in body_data:
pause = random.choice((0.25, 0.5, 0.75, 1))
time.sleep(pause)
body += get_contents(x) body += get_contents(x)
pause = random.choice((4, 5, 6, 7, 8, 9))
self.log('Delay: ', pause, ' seconds')
time.sleep(pause)
return '<html><body>' + cat + title + subhead + auth + lede + caption + '<div>' + body + '</div></body></html>' return '<html><body>' + cat + title + subhead + auth + lede + caption + '<div>' + body + '</div></body></html>'
def preprocess_html(self, soup): def preprocess_html(self, soup):

View File

@ -170,15 +170,16 @@ class Bloomberg(BasicNewsRecipe):
caption = '<span class="cap">' + data['lede']['alt'] + '</span>' caption = '<span class="cap">' + data['lede']['alt'] + '</span>'
if m: if m:
time.sleep(3) time.sleep(5)
body = data['body'] body = data['body']
elif m2: elif m2:
body = '' body = ''
body_data = data['body']['content'] body_data = data['body']['content']
for x in body_data: for x in body_data:
pause = random.choice((0.25, 0.5, 0.75, 1))
time.sleep(pause)
body += get_contents(x) body += get_contents(x)
pause = random.choice((4, 5, 6, 7, 8, 9))
self.log('Delay: ', pause, ' seconds')
time.sleep(pause)
return '<html><body>' + cat + title + subhead + auth + lede + caption + '<div>' + body + '</div></body></html>' return '<html><body>' + cat + title + subhead + auth + lede + caption + '<div>' + body + '</div></body></html>'
def preprocess_html(self, soup): def preprocess_html(self, soup):