Skip to content

Commit

Permalink
Fix no title from monsnode
Browse files Browse the repository at this point in the history
  • Loading branch information
code-yeongyu committed Oct 15, 2023
1 parent da2a8e4 commit 311ff19
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions twtvt/utils/monsnode_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,14 @@ def get_video(self, link: str) -> tuple[str, str]:
return video_name, link

def _parse_video_name(self, soup: BeautifulSoup) -> str:
uploader_name = soup.select('body > div:nth-child(2) > div:nth-child(2) > div:nth-child(5) > b')[0].text
title = soup.select('body > div:nth-child(2) > div:nth-child(2) > div:nth-child(2)')[0].text
try:
uploader_name = soup.select('body > div:nth-child(2) > div:nth-child(2) > div:nth-child(5) > b')[0].text
except IndexError:
uploader_name = 'Unknown'
try:
title = soup.select('body > div:nth-child(2) > div:nth-child(2) > div:nth-child(2)')[0].text
except IndexError:
title = 'Unknown'
title = title.replace('/', '_')
title = title.replace('\n', '')
return f'{uploader_name} - {title}.mp4'
Expand Down

0 comments on commit 311ff19

Please sign in to comment.