(Updated) 0.6.0 - the cli interface.

This commit is contained in:
2022-08-11 18:32:48 +03:00
parent 7394f88d29
commit 5c16001824
4 changed files with 26 additions and 13 deletions
+8 -5
View File
@@ -24,6 +24,8 @@ This module has all for simplify work with scraping.
import requests
from bs4 import BeautifulSoup
from rich.console import Console
from rich.progress import track
import os
class Scraper:
@@ -63,9 +65,10 @@ class Scraper:
poster_url = "https://anitube.in.ua" + soup.find('span', class_="story_post").find('img').get('src')
poster_path = f"{self.POSTER_PATH}/{poster_url.split('/')[-1]}"
if GETPOSTER and not self.file_exist(poster_path):
print(f"[DONWLOADING] The poster for {title}")
img = requests.get(poster_url)
with open(poster_path,'wb') as file:
file.write(img.content)
print(f"[DONWLOADED] The poster for {title}")
console = Console()
with console.status("[yellow]Downloading...[/]"):
img = requests.get(poster_url)
with open(poster_path,'wb') as file:
file.write(img.content)
console.print(f"[green][DONWLOADED][/] The poster for \"{title}\"")
return [url, title, status, poster_path]