Skip to content

Commit

Permalink
Update to latest version of proxy_scraper
Browse files Browse the repository at this point in the history
  • Loading branch information
zolagonano committed May 3, 2024
1 parent 3fb1b26 commit 51dde5f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 25 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ serde = { version = "1.0.198", features = ["derive"] }
serde_json = "1.0.116"
url = "2.5.0"
worker = "0.2.0"
proxy-scraper = { git = "https://github.com/zolagonano/proxy-scraper.git", rev = "3ab6158" , default_features = false, features = ["scraper"] }
proxy-scraper = { git = "https://github.com/zolagonano/proxy-scraper.git", rev = "8f38f3f" , default_features = false, features = ["scraper"] }
reqwest = "0.12.3"

43 changes: 20 additions & 23 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ mod utils;
use crate::config::*;
use crate::telegram::*;
use crate::utils::*;
use proxy_scraper::*;
use std::collections::HashSet;
use worker::*;

Expand Down Expand Up @@ -54,41 +55,37 @@ impl Command {
let raw_proxies = fetch_sources(self.get_sources()).await;

match self {
Command::MTProxy => proxy_scraper::Scraper::scrape_mtproxy(&raw_proxies)
Command::MTProxy => mtproxy::MTProxy::scrape(&raw_proxies)
.iter()
.for_each(|proxy| {
proxy_list.insert(format!("[{}]({})", proxy.to_url(), proxy.to_url()));
}),
Command::Shadowsocks => proxy_scraper::Scraper::scrape_shadowsocks(&raw_proxies)
Command::Shadowsocks => shadowsocks::Shadowsocks::scrape(&raw_proxies)
.iter()
.for_each(|proxy| {
proxy_list.insert(format!("`{}`", proxy.to_url()));
}),
Command::VMess => proxy_scraper::Scraper::scrape_vmess(&raw_proxies)
.iter()
.for_each(|proxy| {
proxy_list.insert(format!("`{}`", proxy.to_url()));
}),
Command::VLess => proxy_scraper::Scraper::scrape_vless(&raw_proxies)
.iter()
.for_each(|proxy| {
proxy_list.insert(format!("`{}`", proxy.to_url()));
}),
Command::Trojan => proxy_scraper::Scraper::scrape_trojan(&raw_proxies)
.iter()
.for_each(|proxy| {
proxy_list.insert(format!("`{}`", proxy.to_url()));
}),
Command::Hysteria => proxy_scraper::Scraper::scrape_hysteria(&raw_proxies)
.iter()
.for_each(|proxy| {
proxy_list.insert(format!("`{}`", proxy.to_url()));
}),
Command::TUIC => proxy_scraper::Scraper::scrape_tuic(&raw_proxies)
Command::VMess => vmess::VMess::scrape(&raw_proxies).iter().for_each(|proxy| {
proxy_list.insert(format!("`{}`", proxy.to_url()));
}),
Command::VLess => vless::VLess::scrape(&raw_proxies).iter().for_each(|proxy| {
proxy_list.insert(format!("`{}`", proxy.to_url()));
}),
Command::Trojan => trojan::Trojan::scrape(&raw_proxies)
.iter()
.for_each(|proxy| {
proxy_list.insert(format!("`{}`", proxy.to_url()));
}),
Command::Hysteria => {
hysteria::Hysteria::scrape(&raw_proxies)
.iter()
.for_each(|proxy| {
proxy_list.insert(format!("`{}`", proxy.to_url()));
})
}
Command::TUIC => tuic::TUIC::scrape(&raw_proxies).iter().for_each(|proxy| {
proxy_list.insert(format!("`{}`", proxy.to_url()));
}),
_ => (),
};

Expand Down

0 comments on commit 51dde5f

Please sign in to comment.