Status check for Hentai@Home Client.
- Status4HaH
You need to have E-Hentai account, and already running Hentai@Home client.
- Scheduling
Using Crontab for job scheduling.
#MIM HOUR DAY MONTH WEEK
*/30 * * * * root python /script_path/status_notification.py
- Avoiding for making heavy server load on E-Hentai.
- Not recommended for change less then 30 minutes.
Using cookies to login is the same as using a browser extension or viewer.
If your browser is Chrome-based (ex. Google Chrome or Microsoft Edge), right-click to open Developer Tools and switch to the Network
panel. After refreshing the Hentai@Home page, click the element called hentaiathome.php, which tags cookies. You can find ipb_member_id
and ipb_pass_hash
.
Please fill in the cookie's value inin theonfiguration file. If you didn't fill in the configuration, it will ask for the cookie when you run the script.
Configuration not found, please initialize.
Please enter the ipb_member_id: 114514
Please enter the ipb_pass_hash: ••••••••••••••••••••••••••••••••
- Google account needed, sign in using App passwords.
- Receiver mail address is unlimited.
The first time you run the mail alert function, it will check the configuration file. If the mail configuration is not found, it will return a string Mail configuration not found, please initialize.
- Using Telegram Bot, contect BotFather create new Bot accounts.
- HTTP
API Token
andchat id
are needed. - If the chat channel wasn't created, the Telegram API will return
HTTP 400 Bad Request
. You need to start the chat channel, including that bot.
The first time you run the Telegram alert function, it will check the configuration file. If Telegram Bot configuration is not found, it will return the string Telegram configuration not found, please initialize.
- Status4HaH store configuration as JSON format file.
- Configuration file named
status4hah.config.json
.
You can editing the clean copy, which looks like this:
{
"last_update_time": "",
"ipb_member_id": "",
"ipb_pass_hash": "",
"request_header": "",
"mail_sender": "",
"mail_scepter": "",
"mail_receiver": "",
"telegram_token": "",
"telegram_id": "",
"alert_counting":false
}
If you fill in the correct configuration, it will skip the initialization check and running script.
Some module not included in Python Standard Library are needed.
- Although the password inside the cookie has been hashed,
- if someone modifies the script, add a backdoor function to send it back.
- It's possible to login to your account without knowing the actual username and password.
- The original Status4HaH won't have those functions.
- Please make sure you download the clean copy from this repository.
- Import as module
import status4hentai
- Alternatively, you can import the function independently.
from status4hentai import CheckHentaiatHome
# Get Hentai@Home Status
HentaiAtHomePayload = status4hentai.CheckHentaiatHome(ConfigFilePath)
# Check Hentai@Home status
StatusTable = status4hentai.GetHentaiStatus(HentaiAtHomePayload)
- It will return
Pandas DataFrame
if parsing HTML content correctly. - If the return is
String
, it may contain an error message such as an HTTP status code, a cookie expiration alert, or another erroe message. Please review the error handling instatus4hah.error.log
.
- The demonstration script is
status_notification.py
. - Configuration as follows are needed.
# Configuration file path
ConfigFilePath = "status4hah.config.json"
# Runtime file and path
StatusFilePath = "status4hah.status.csv"
# Status file filter
CheckingResultFilter = ["ID","Created","Client IP","Port","Version","Max Speed","Country"]
# Status file and path
CheckingResultPath = "status4hah.check.csv"
# Alert mode selection
AlertMode = 0
# Alert output filter
AlertFilter = ["Files Served","Trust","Quality","Hitrate","Hathrate"]
When login cookie expires, you will receive an alert message: Cookie expires. Please update the configuration file
.
- The demonstration script is
status_recorder.py
. - Configuration as follows are needed.
# Configuration file path
ConfigFilePath = "status4hah.config.json"
# Runtime file and path
StatusFilePath = "status4hah.status.csv"
# Recording file filter
RecordingFilter = ["ID","Created","Client IP","Port","Version","Max Speed","Country"]
# Recording file path
RecordingPath = "status4hah.record.csv"
status_monitor.php
is a simple php script webpage to view the status file generated by status_notification.py
.
- See the Demonstration.
- Python 3.6 or above
- sys
- time
- json
- pandas
- logging
- smtplib
- requests
- datetime
- getpass
- BeautifulSoup
- MIMEText
- Apache or NGINX
- php 7.3 or above, recommend using php-FPM
General Public License -3.0