-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from ajipw/gui
Add GUI Support
- Loading branch information
Showing
45 changed files
with
25,091 additions
and
12 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
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 |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import requests | ||
from bs4 import BeautifulSoup | ||
|
||
url = "https://anitoki.com/2021/05/kyuukyoku-shinka-shita-full-dive-rpg-ga-genjitsu-yori-mo-kusoge-dattara-08-subtitle-indonesia/" | ||
|
||
r = requests.get(url) | ||
b = BeautifulSoup(r.text, 'html.parser') | ||
|
||
|
||
h264_360 = [] | ||
h264_480 = [] | ||
h264_720 = [] | ||
h264_1080 = [] | ||
|
||
h265_480 = [] | ||
h265_720 = [] | ||
|
||
for download in b.find_all('div', class_= 'smokeddl'): | ||
# print(download.find('div', class_="smokettl").text) | ||
for dl_link in download.find_all('div', class_="smokeurl"): | ||
url_link = [] | ||
if dl_link.strong is None: | ||
continue | ||
# print(dl_link.strong.text) | ||
# h264 | ||
if "h264" in download.find('div', class_="smokettl").text and "360P" in dl_link.strong.text: | ||
for url in dl_link.find_all('a'): | ||
h264_360.append(url['href']) | ||
|
||
if "h264" in download.find('div', class_="smokettl").text and "480P" in dl_link.strong.text: | ||
for url in dl_link.find_all('a'): | ||
h264_480.append(url['href']) | ||
|
||
if "h264" in download.find('div', class_="smokettl").text and "720P" in dl_link.strong.text: | ||
for url in dl_link.find_all('a'): | ||
h264_720.append(url['href']) | ||
|
||
if "h264" in download.find('div', class_="smokettl").text and "1080P" in dl_link.strong.text: | ||
for url in dl_link.find_all('a'): | ||
h264_1080.append(url['href']) | ||
|
||
# h265 | ||
if "h265" in download.find('div', class_="smokettl").text and "480P" in dl_link.strong.text: | ||
for url in dl_link.find_all('a'): | ||
h265_480.append(url['href']) | ||
|
||
if "h265" in download.find('div', class_="smokettl").text and "720P" in dl_link.strong.text: | ||
for url in dl_link.find_all('a'): | ||
h265_720.append(url['href']) | ||
|
||
|
||
print(h264_360) | ||
print(h264_480) | ||
print(h264_720) | ||
print(h264_1080) | ||
print(h265_480) | ||
print(h265_720) | ||
|
||
# if str(dl_link.strong.text).find("360p") == -1 and str(download.find('div', class_="smokettl").text).find("h264") == -1: | ||
# for url in dl_link.find_all('a'): | ||
# url_link.append(url['href']) | ||
# print(url_link) | ||
# print(url_link) | ||
|
||
for div in b.find_all('figure', class_="wp-block-image"): | ||
for img in div.find_all('img', attrs={'loading': 'lazy'}): | ||
print(img['src']) | ||
|
||
for h1 in b.find_all('h1', class_="jdlx"): | ||
title = h1.text | ||
print(h1.text) |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
APP_NAME = "Anime Scrapper Indonesia" | ||
APP_NAME_NO_SPACE = APP_NAME.replace(' ', '') | ||
APP_VERSION = '0.1' | ||
APP_DESCRIPTION = "Browse anime from Indonesia without ads" | ||
COMPANY_NAME = "Nexiamuel" | ||
WEBSITE = "https://github.com/ajipw/anime-grabber" |
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 |
---|---|---|
@@ -0,0 +1,92 @@ | ||
import logging | ||
import os | ||
import sys | ||
from logging.handlers import RotatingFileHandler | ||
from pathlib import Path | ||
|
||
from gui.__info__ import APP_NAME, APP_VERSION, COMPANY_NAME | ||
|
||
""" | ||
Paths | ||
On Windows Vista+, applications should not write files into Program Files. Programs should use APPDATA | ||
The logic below determines if the program is installed in Program Files or not. | ||
It also determines if the program is has been "frozen" with PyInstaller. | ||
It sets the paths accordingly. | ||
ROOT_PATH: The path to the directory where your application is installed | ||
WRITE_PATH: The path to the directory where your application should write files | ||
""" | ||
|
||
ROOT_PATH = os.path.dirname(os.path.abspath(__file__)) | ||
_program_files = os.environ.get('PROGRAMFILES') | ||
if ROOT_PATH.startswith(_program_files): | ||
ROOT_PATH = os.path.dirname(ROOT_PATH) | ||
WRITE_PATH = os.environ['APPDATA'] | ||
WRITE_PATH = str(Path(WRITE_PATH, COMPANY_NAME, APP_NAME)) | ||
else: | ||
WRITE_PATH = ROOT_PATH | ||
if getattr(sys, 'frozen', False): | ||
ROOT_PATH = os.path.dirname(ROOT_PATH) | ||
|
||
_log_path = str(Path(WRITE_PATH, '{}.log'.format(APP_NAME.lower()))) | ||
|
||
|
||
def get_root_path(*args) -> str: | ||
""" | ||
Return ROOT program path | ||
Optionally create a new path from ROOT path when *args are given | ||
:return: ROOT program path | ||
""" | ||
|
||
return str(Path(ROOT_PATH, *args)) | ||
|
||
|
||
def get_write_path(*args) -> str: | ||
""" | ||
Get path to write files | ||
Optionally create a new path from WRITE path when *args are given | ||
:return: Path to write files | ||
""" | ||
|
||
return str(Path(WRITE_PATH, *args)) | ||
|
||
|
||
def _create_write_path(): | ||
""" | ||
Create WRITE_PATH | ||
""" | ||
|
||
path = get_write_path() | ||
Path(path).mkdir(parents=True, exist_ok=True) | ||
|
||
|
||
_create_write_path() | ||
# -- | ||
|
||
# -- Logging | ||
logger = logging.getLogger(__name__) | ||
formatter = logging.Formatter('%(asctime)s %(name)-6s %(levelname)-8s %(message)s') | ||
|
||
# Console logging | ||
handler = logging.StreamHandler() | ||
handler.setFormatter(formatter) | ||
logger.addHandler(handler) | ||
|
||
# File logging | ||
handler = RotatingFileHandler(_log_path, mode='a', maxBytes=10 * 1024 * 1024, backupCount=1, encoding='utf-8', delay=0) | ||
handler.setFormatter(formatter) | ||
handler.setLevel(logging.DEBUG) | ||
logger.addHandler(handler) | ||
|
||
logger.setLevel(logging.DEBUG) | ||
# -- | ||
|
||
logger.info("{} v{}".format(APP_NAME, APP_VERSION)) | ||
logger.debug("_program_files: '{}'".format(_program_files)) | ||
logger.debug("log path: '{}'".format(_log_path)) | ||
logger.info("ROOT_PATH: '{}'".format(ROOT_PATH)) | ||
logger.info("WRITE_PATH: '{}'".format(WRITE_PATH)) |
Oops, something went wrong.