From 29e926548396566a29acb7d85e7e3bd3a53afef4 Mon Sep 17 00:00:00 2001 From: bakatrouble Date: Wed, 6 May 2020 19:05:14 +0300 Subject: [PATCH] fixes --- feeds/modules/tapas.py | 17 +++++++++-------- feeds/modules/vk_music.py | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/feeds/modules/tapas.py b/feeds/modules/tapas.py index f852861..82fc916 100644 --- a/feeds/modules/tapas.py +++ b/feeds/modules/tapas.py @@ -30,14 +30,15 @@ class TapasFeedModuleConfig(FeedModuleConfig): f'https://tapas.io/series/{self.display_name}', headers={'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:67.0) Gecko/20100101 Firefox/67.0'}, ).text - episode_list = json.loads(re.search(r'episodeList : (\[.*\]),', series_page).group(1)) - for episode in episode_list: - eid = episode['id'] - title = episode['title'] + ssoup = BeautifulSoup(series_page, 'html.parser') + # episode_list = json.loads(re.search(r'episodeList : (\[.*\]),', series_page).group(1)) + for episode in ssoup.select('a[data-ga-category=Episode]'): + eid = int(episode['data-id']) + title = episode.select_one('.info__title').text.strip() if eid <= last_id: continue - if not episode['free']: - continue + # if not episode['free']: + # continue caption = f'{title}\nhttps://tapas.io/episode/{eid}' @@ -46,8 +47,8 @@ class TapasFeedModuleConfig(FeedModuleConfig): headers={'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:67.0) Gecko/20100101 Firefox/67.0'}, ).text, 'html.parser') imgs = [] - for img in esoup.select(f'#episode-{eid} .art-image'): - imgs.append(img['src']) + for img in esoup.select(f'.js-episode-article .content__img'): + imgs.append(img['data-src']) if len(imgs) == 1: bot.send_photo(chat_id, imgs[0], caption=caption) diff --git a/feeds/modules/vk_music.py b/feeds/modules/vk_music.py index 1a847ac..18984fe 100644 --- a/feeds/modules/vk_music.py +++ b/feeds/modules/vk_music.py @@ -27,7 +27,7 @@ class VKMusicFeedModuleConfig(FeedModuleConfig): if last_id is None: last_id = 0 - raise StopIteration() + return [] vk_session = VkApi(login=config.vk_username, password=config.vk_password, config=DatabaseConfig, api_version='5.60', captcha_handler=captcha_handler)