-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Yiffer Support, Fixed time issue on E621 & E926
Yiffer is now supported Fixed long sleep time on E621 and E926
- Loading branch information
1 parent
97c042e
commit f0edc0b
Showing
7 changed files
with
68 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,5 @@ modules/__pycache__/ | |
dist/ | ||
|
||
build/ | ||
|
||
media/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,52 @@ | ||
# Phew a bit empty in here isn't it? | ||
import requests | ||
import random | ||
from termcolor import colored | ||
from time import sleep | ||
from alive_progress import alive_bar | ||
import os | ||
|
||
class Yiffer(): | ||
def Fetcher(proxy_list, user_proxies, header, URL): | ||
|
||
# link operations | ||
URL = requests.utils.unquote(URL, encoding='utf-8', errors='replace') | ||
parts = URL.split("/") | ||
print(parts) | ||
title = parts[3] | ||
print(title) | ||
|
||
# Get item info | ||
URL = f"https://yiffer.xyz/api/comics/{title}" | ||
if user_proxies == True: | ||
proxy = random.choice(proxy_list) | ||
req = requests.get(URL, headers=header, proxies=proxy).json() | ||
else: | ||
req = requests.get(URL, headers=header).json() | ||
pages = req["numberOfPages"] | ||
page_range = pages + 1 | ||
|
||
# Download all images | ||
with alive_bar(pages, calibrate=1, dual_line=True, title='Downloading') as bar: | ||
bar.text = f'-> Downloading: {title}, please wait...' | ||
progress = 0 | ||
for number in range(1,page_range): | ||
progress += 1 | ||
if progress <= 9: | ||
URL = f"https://static.yiffer.xyz/comics/{title}/00{progress}.jpg" | ||
elif progress >= 10 and progress < 100: | ||
URL = f"https://static.yiffer.xyz/comics/{title}/0{progress}.jpg" | ||
else: | ||
URL = f"https://static.yiffer.xyz/comics/{title}/{progress}.jpg" | ||
if user_proxies == True: | ||
proxy = random.choice(proxy_list) | ||
img_data = requests.get(URL, proxies=proxy).content | ||
else: | ||
sleep(1) | ||
img_data = requests.get(URL).content | ||
if not os.path.exists(f"media/{title}"): | ||
os.mkdir(f"media/{title}") | ||
with open(f"media/{title}/{str(number)}.jpg", "wb") as handler: | ||
handler.write(img_data) | ||
bar() | ||
print("[ " + colored("i","blue") + " ] " + f"Completed downloading {title}!") | ||
sleep(5) |