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}', 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'}, headers={'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:67.0) Gecko/20100101 Firefox/67.0'},
).text ).text
episode_list = json.loads(re.search(r'episodeList : (\[.*\]),', series_page).group(1)) ssoup = BeautifulSoup(series_page, 'html.parser')
for episode in episode_list: # episode_list = json.loads(re.search(r'episodeList : (\[.*\]),', series_page).group(1))
eid = episode['id'] for episode in ssoup.select('a[data-ga-category=Episode]'):
title = episode['title'] eid = int(episode['data-id'])
title = episode.select_one('.info__title').text.strip()
if eid <= last_id: if eid <= last_id:
continue continue
if not episode['free']: # if not episode['free']:
continue # continue
caption = f'{title}\nhttps://tapas.io/episode/{eid}' 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'}, headers={'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:67.0) Gecko/20100101 Firefox/67.0'},
).text, 'html.parser') ).text, 'html.parser')
imgs = [] imgs = []
for img in esoup.select(f'#episode-{eid} .art-image'): for img in esoup.select(f'.js-episode-article .content__img'):
imgs.append(img['src']) imgs.append(img['data-src'])
if len(imgs) == 1: if len(imgs) == 1:
bot.send_photo(chat_id, imgs[0], caption=caption) bot.send_photo(chat_id, imgs[0], caption=caption)

View File

@ -27,7 +27,7 @@ class VKMusicFeedModuleConfig(FeedModuleConfig):
if last_id is None: if last_id is None:
last_id = 0 last_id = 0
raise StopIteration() return []
vk_session = VkApi(login=config.vk_username, password=config.vk_password, config=DatabaseConfig, vk_session = VkApi(login=config.vk_username, password=config.vk_password, config=DatabaseConfig,
api_version='5.60', captcha_handler=captcha_handler) api_version='5.60', captcha_handler=captcha_handler)