This commit is contained in:
bakatrouble 2020-05-06 19:05:14 +03:00
parent ccd7368acf
commit 29e9265483
2 changed files with 10 additions and 9 deletions

View File

@ -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)

View File

@ -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)