Files
wscraper/README.md

132 lines
4.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<p align="center">
<img src="logo-v2.png" alt="wscraper logo" width="240" height=/>
</p>
<p align="center">
<a href="https://gitea.wisecolt-panda.net/wisecolt/Bookmark-Tracker">
<img src="https://img.shields.io/badge/Gitea-Repository-609926?logo=gitea&logoColor=white" alt="Gitea">
</a>
<img src="https://img.shields.io/badge/Python-3.12%2B-3776AB?logo=python&logoColor=white" alt="Python">
<img src="https://img.shields.io/badge/E2E_Tests-enabled-22c55e?logo=pytest&logoColor=white" alt="E2E Tests">
<img src="https://img.shields.io/badge/Platform-macOS%20%7C%20Linux%20%7C%20Windows-1f6feb" alt="Platform">
<img src="https://img.shields.io/badge/Layout-src%2F%20package-0A7B83" alt="Layout">
</p>
HappyFappy için komutlar paketlenmiş `wscraper` CLI üzerinden çalışır. Proje çoklu site desteği için `src/` paket yapısına göre düzenlenmiştir.
## 1) Repo Clone
```bash
git clone <REPO_URL>
cd <REPO_FOLDER>
```
## 2) Kurulum
### macOS / Linux
```bash
python3.12 -m venv .venv
source .venv/bin/activate
python -m pip install -U pip
python -m pip install -e .
scrapling install
```
### Windows (PowerShell)
```powershell
py -3.12 -m venv .venv
.venv\Scripts\Activate.ps1
python -m pip install -U pip
python -m pip install -e .
scrapling install
```
### Windows (CMD)
```bat
py -3.12 -m venv .venv
.venv\Scripts\activate.bat
python -m pip install -U pip
python -m pip install -e .
scrapling install
```
Not: Ortamı aktive ettikten sonra komutlar `wscraper ...` olarak kullanılabilir. İstersen `python -m wscraper ...` da kullanabilirsin.
## 3) HappyFappy Komutları
### Bookmarks Çekme
```bash
wscraper happyfappy --action get-bookmarks -c cookies.txt -o bookmarks.json
```
### Torrent Dosyası İndirme
```bash
wscraper happyfappy --action download-torrent-files -u "https://www.happyfappy.net/torrents.php?id=110178" -c cookies.txt -o torrent
```
### Torrent İndir + Bookmark Kaldır
`--rm-bookmark` (kisa alias: `-rmb`) flag'i verildiginde, torrent dosyasi basariyla indirildikten sonra ayni torrent detay sayfasindaki bookmark remove mekanizmasi dinamik olarak bulunur ve tetiklenir.
```bash
wscraper happyfappy --action download-torrent-files --rm-bookmark -u "https://www.happyfappy.net/torrents.php?id=110178" -c cookies.txt -o torrent
```
Davranis kurallari:
- Torrent indirme basarisizsa bookmark silme adimina gecilmez.
- `--rm-bookmark` verilmis ve bookmark silme basarisizsa komut `exit code 1` ile biter.
- `--rm-bookmark` verilmemisse yalnizca indirme akisi calisir.
Bookmark remove tespiti tek bir sabit HTML selector'ine bagli degildir:
- oncelik `onclick`/event sinyalleri (or. `Unbookmark(...)`)
- `id/class/href` icinde bookmark semantigi
- remove/delete/unbookmark benzeri metin ve attribute sinyalleri
- torrent id ile iliskili kontrol eslestirmesi
## 4) Kısa Alias Kullanımı
```bash
# site alias: hf
# action alias: gb (get-bookmarks), dtf (download-torrent-files)
wscraper hf -a gb -c cookies.txt -o bookmarks.json
wscraper hf -a dtf -u "https://www.happyfappy.net/torrents.php?id=110178" -c cookies.txt -o torrent
wscraper hf -a dtf --rm-bookmark -u "https://www.happyfappy.net/torrents.php?id=110178" -c cookies.txt -o torrent
wscraper hf -a dtf -rmb -u "https://www.happyfappy.net/torrents.php?id=110178" -c cookies.txt -o torrent
```
## 5) Proje Dizini
```text
.
├── pyproject.toml
├── requirements.txt
├── src/
│ └── wscraper/
│ ├── __init__.py
│ ├── __main__.py
│ ├── cli.py
│ └── sites/
│ ├── __init__.py
│ └── happyfappy.py
└── README.md
```
## 6) E2E Test (Canli)
Bu testler gercek siteye istek atar ve link/selector kirilmalarini yakalamayi hedefler.
```bash
python -m pip install -e ".[test]"
WSCRAPER_E2E=1 pytest -m e2e -s -vv --color=yes
```
Opsiyonel degiskenler:
- `WSCRAPER_COOKIE_FILE` (varsayilan: `cookies.txt`)
- `WSCRAPER_TEST_TORRENT_URL` (varsayilan: `https://www.happyfappy.net/torrents.php?id=110178`)