From dc61e880898dea474a7ec0f4ece571cdc9453011 Mon Sep 17 00:00:00 2001 From: unkn0w7n <51942695+unkn0w7n@users.noreply.github.com> Date: Sun, 5 May 2024 12:10:19 +0530 Subject: [PATCH] Lex Fridman Podcast recipe --- recipes/caravan_magazine.recipe | 2 ++ recipes/icons/lex_fridman_podcast.png | Bin 0 -> 271 bytes recipes/lex_fridman_podcast.recipe | 44 ++++++++++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 recipes/icons/lex_fridman_podcast.png create mode 100644 recipes/lex_fridman_podcast.recipe diff --git a/recipes/caravan_magazine.recipe b/recipes/caravan_magazine.recipe index 98e86d58f6..f0ec508791 100644 --- a/recipes/caravan_magazine.recipe +++ b/recipes/caravan_magazine.recipe @@ -55,6 +55,8 @@ def parse_p(p): yield '' else: yield p['text'] + elif p.get('type', '') == 'hard_break': + yield '
' class CaravanMagazine(BasicNewsRecipe): diff --git a/recipes/icons/lex_fridman_podcast.png b/recipes/icons/lex_fridman_podcast.png new file mode 100644 index 0000000000000000000000000000000000000000..18427862c20618d6badf2a13370502d65b8f2e59 GIT binary patch literal 271 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbL!Q-Dv1E0D$n?gc(*g8%>j7Znw? zva(vTWXb;h`?a;T7cE-U)6?_$^Jl#ZjeS7XJS9PX!SC~qoN=j{#_-2#LF{jpJ()o9 z0#6sm5Q(X|{gFZq3OvrI^`aad-q(jli@CdfcD<*vl=b+fV^NP^3*XRk5c0U+uwvVy z-bS_g>rNyv`a3AL)#~di%N8^oxacj%vyYK0B0Yg!ga5@;k)n*Lc2i2PE&QXqj4>si kr?|(k_(A^H_l2K-nkyu8Zdw|o%@6W{r>mdKI;Vst0ALkX$^ZZW literal 0 HcmV?d00001 diff --git a/recipes/lex_fridman_podcast.recipe b/recipes/lex_fridman_podcast.recipe new file mode 100644 index 0000000000..6b8684cfd0 --- /dev/null +++ b/recipes/lex_fridman_podcast.recipe @@ -0,0 +1,44 @@ +from calibre.web.feeds.news import BasicNewsRecipe + +class lexfridman(BasicNewsRecipe): + title = 'Lex Fridman Podcast' + description = ( + 'Transcripts from Lex Fridman Podcast. Conversations about science, technology, history, ' + 'philosophy and the nature of intelligence, consciousness, love, and power. Lex is an AI ' + 'researcher at MIT and beyond. Download monthly.' + ) + oldest_article = 30 # days + __author__ = 'unkn0wn' + language = 'en' + encoding = 'utf-8' + remove_attributes = ['style', 'height', 'width'] + no_stylesheets = True + ignore_duplicate_articles = {'url'} + use_embedded_content = False + timefmt = ' [%b, %Y]' + cover_url = 'https://i.scdn.co/image/ab6765630000ba8a563ebb538d297875b10114b7' + + extra_css = ''' + .ts-name { font-weight:bold; } + .ts-timestamp { font-size:small; } + ''' + + keep_only_tags = [dict(name='article')] + remove_tags = [ + dict(name=['svg']), + dict(name='div', attrs={'class':'episode-player'}) + ] + + feeds = [ + ('Transcripts', 'https://lexfridman.com/feed/podcast/') + ] + + def print_version(self, url): + return url.split('?')[0][:-1] + '-transcript/' + + def preprocess_html(self, soup): + for div in soup.findAll('div', attrs={'class':'ts-segment'}): + div.name = 'p' + for name in soup.findAll('span', attrs={'class':'ts-name'}): + name.name = 'div' + return soup