Skip to content

Commit

Permalink
Merge pull request #1 from ajipw/gui
Browse files Browse the repository at this point in the history
Add GUI Support
  • Loading branch information
NexiaMoe authored Jun 1, 2021
2 parents 77c5418 + f81c5ff commit 573318a
Show file tree
Hide file tree
Showing 45 changed files with 25,091 additions and 12 deletions.
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ venv/
ENV/
env.bak/
venv.bak/
venv

# Spyder project settings
.spyderproject
Expand All @@ -127,3 +128,12 @@ dmypy.json

# Pyre type checker
.pyre/

# Custom
anime
blob_storage
webrtc_event_logs
.vscode
.idea
ignorethis.py
.vs
41 changes: 29 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,44 @@
# anitoki-grabber
Get download link anime from anitoki website without browsing through browser
# Anime-grabber
Get anime list from anime fanshare, fansub website without browsing.

![Home](screenshot/Home.png)
![Description](screenshot/Description.png)
![Download](screenshot/Download.png)

# What the plus side ?
+ Get download link without see any ads on anitoki.web.id
+ Get download Get anime list
+ Fast

# What the minus side ?
- There is no image yet
- No anime description right now
- No Link Cache
- Only use terminal at the moment

# How to use ?
- Clone this git
- Activate the virtual enviroment on venv/Script/activate / activate.bat / activate.ps1
- run this on command line / terminal
- Create Virtual Enviroment or without Virtual Enviroment
- Run command:
```bash
pip install -r requirement.txt
```
- Goto directory that you have clonned
- Run command:
```bash
python anitoki.py
python -m gui
```

- Select any anime, and you get the download link

# Task list
- [x] Push to my github for first time
- [ ] Add anime description
- [ ] Add link cache to csv or excel
- [ ] Use GUI instead Terminal with image
- [x] Add anime description
- [x] Use GUI instead Terminal with image
- [ ] Pagination
- [x] Dynamic page

# Anime list
- [x] Anitoki
- [x] Samehadaku
- [ ] Nekopoi
- [ ] More will be added or open issues

## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Expand All @@ -33,3 +47,6 @@ Please make sure to update tests as appropriate.

## License
[MIT](https://choosealicense.com/licenses/mit/)

#### Thanks to
- [**Neuron**](https://github.com/Andrew-Shay/Neuron) for providing template
4 changes: 4 additions & 0 deletions anitoki.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ def first():
print("(",no,")", title.h2.text, title.find_all('p')[1].getText())
no += 1
link.append(title.h2.a['href'])

for thumb in soup.find_all('div', class_="thumbz"):
print(thumb.img['src'])

menu()


Expand Down
71 changes: 71 additions & 0 deletions gui.py
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)
6 changes: 6 additions & 0 deletions gui/__info__.py
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"
92 changes: 92 additions & 0 deletions gui/__init__.py
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))
Loading

0 comments on commit 573318a

Please sign in to comment.