(Updated) 0.6.0 - the cli interface.
This commit is contained in:
+8
-5
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user