Просто спарсь что угодно с помощью языка Rust (ну… или просто скачай файл)
Известно, что Rust — типобезопасный язык программирования, код которого проверяется компилятором ещё до сборки. С одной стороны это хорошо: меньше вероятности внезапного сбоя в самый неподходящий момент. С другой стороны — код, выполняющий одну функцию, в итоге может стать очень сложным и иногда нечитаемым.
В пример привожу функцию, которая парсит названия валют с сайта floatrates и выводит их (пожалуйста, напишите в комментариях, за сколько минут вы поняли эту строку):
// main.rs use anyhow::anyhow; use reqwest::blocking::get; use scraper::{Html, Selector};
fn main() -> anyhow::Result<()> { let body = get("http://www.floatrates.com/json-feeds.html")?.text()?; let document = Html::parse_document(&body); let selector = Selector::parse("div.bk-json-feeds>div.body>ul>li>a") .map_err(|err| anyhow!("{err}"))?;
for element in document.select(&selector) { println!("{}", element.inner_html()); } Ok(()) }
В этой статье я хочу рассказать о своей новой библиотеке, значительно упрощающей парсинг на Rust. Приятного чтения!
Просто спарсь что угодно с помощью языка Rust (ну… или просто скачай файл)
Известно, что Rust — типобезопасный язык программирования, код которого проверяется компилятором ещё до сборки. С одной стороны это хорошо: меньше вероятности внезапного сбоя в самый неподходящий момент. С другой стороны — код, выполняющий одну функцию, в итоге может стать очень сложным и иногда нечитаемым.
В пример привожу функцию, которая парсит названия валют с сайта floatrates и выводит их (пожалуйста, напишите в комментариях, за сколько минут вы поняли эту строку):
// main.rs use anyhow::anyhow; use reqwest::blocking::get; use scraper::{Html, Selector};
fn main() -> anyhow::Result<()> { let body = get("http://www.floatrates.com/json-feeds.html")?.text()?; let document = Html::parse_document(&body); let selector = Selector::parse("div.bk-json-feeds>div.body>ul>li>a") .map_err(|err| anyhow!("{err}"))?;
for element in document.select(&selector) { println!("{}", element.inner_html()); } Ok(()) }
В этой статье я хочу рассказать о своей новой библиотеке, значительно упрощающей парсинг на Rust. Приятного чтения!
Telegram and Signal Havens for Right-Wing Extremists
Since the violent storming of Capitol Hill and subsequent ban of former U.S. President Donald Trump from Facebook and Twitter, the removal of Parler from Amazon’s servers, and the de-platforming of incendiary right-wing content, messaging services Telegram and Signal have seen a deluge of new users. In January alone, Telegram reported 90 million new accounts. Its founder, Pavel Durov, described this as “the largest digital migration in human history.” Signal reportedly doubled its user base to 40 million people and became the most downloaded app in 70 countries. The two services rely on encryption to protect the privacy of user communication, which has made them popular with protesters seeking to conceal their identities against repressive governments in places like Belarus, Hong Kong, and Iran. But the same encryption technology has also made them a favored communication tool for criminals and terrorist groups, including al Qaeda and the Islamic State.
How Does Telegram Make Money?
Telegram is a free app and runs on donations. According to a blog on the telegram: We believe in fast and secure messaging that is also 100% free. Pavel Durov, who shares our vision, supplied Telegram with a generous donation, so we have quite enough money for the time being. If Telegram runs out, we will introduce non-essential paid options to support the infrastructure and finance developer salaries. But making profits will never be an end-goal for Telegram.