feat(misc): add misc endpoints (currency-converter, harga-emas, kurs-bca, server-info)
Deploy Scraper / build-and-deploy (push) Canceled after 0s
Deploy Scraper / build-and-deploy (push) Canceled after 0s
Ported from Shirokami-API scraper/misc/*.js: - /misc/currency-converter (wise.com scrape, amount/from/to) - /misc/harga-emas (harga-emas.org Antam table) - /misc/kurs-bca (bca.co.id jual/beli) - /misc/server-info (OS/CPU/RAM/disk from /proc) Also: remove /download/tiktok/v2 + /download/twitter/v2 as separate routes; douyin.wtf + twitsave now internal fallback steps in the primary fetch_tiktok/fetch_twitter chains (v2 = fallback per user directive).
This commit is contained in:
1 parent
dc44085cad
commit
6df8af54eb
10 files changed
+473
-59
No files matched your search
@@ -123,14 +123,6 @@ pub async fn download_videy(url: &str) -> Result<DownloadResult, ScrapingError>
|
||||
DownloaderRepository::download_videy(url).await
|
||||
}
|
||||
|
||||
pub async fn download_tiktok_v2(url: &str) -> Result<DownloadResult, ScrapingError> {
|
||||
DownloaderRepository::download_tiktok_v2(url, None).await
|
||||
}
|
||||
|
||||
pub async fn download_twitter_v2(url: &str) -> Result<DownloadResult, ScrapingError> {
|
||||
DownloaderRepository::download_twitter_v2(url, None).await
|
||||
}
|
||||
|
||||
pub async fn download_bilibili(url: &str) -> Result<DownloadResult, ScrapingError> {
|
||||
DownloaderRepository::download_bilibili(url).await
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
//! Application use-cases for misc utilities.
|
||||
|
||||
use crate::domain::error::ScrapingError;
|
||||
use crate::infrastructure::repository::misc as Repo;
|
||||
use serde_json::Value;
|
||||
|
||||
/// Currency converter.
|
||||
pub async fn currency_converter(amount: f64, from: &str, to: &str) -> Result<Value, ScrapingError> {
|
||||
Repo::fetch_currency_converter(amount, from, to)
|
||||
.await
|
||||
.map_err(ScrapingError::Http)
|
||||
}
|
||||
|
||||
/// Harga emas Antam.
|
||||
pub async fn harga_emas() -> Result<Value, ScrapingError> {
|
||||
Repo::fetch_harga_emas()
|
||||
.await
|
||||
.map_err(ScrapingError::Http)
|
||||
}
|
||||
|
||||
/// Kurs BCA (jual/beli).
|
||||
pub async fn kurs_bca() -> Result<Value, ScrapingError> {
|
||||
Repo::fetch_kurs_bca()
|
||||
.await
|
||||
.map_err(ScrapingError::Http)
|
||||
}
|
||||
|
||||
/// Server info (OS/CPU/RAM/disk).
|
||||
pub async fn server_info() -> Result<Value, ScrapingError> {
|
||||
Repo::fetch_server_info()
|
||||
.await
|
||||
.map_err(ScrapingError::Http)
|
||||
}
|
||||
@@ -2,4 +2,5 @@ pub mod anime;
|
||||
pub mod anime2;
|
||||
pub mod downloader;
|
||||
pub mod komik;
|
||||
pub mod misc;
|
||||
pub mod proxy;
|
||||
Reference in new issue
Block a user