mirror of
https://github.com/catdevnull/preciazo.git
synced 2024-11-22 22:26:19 +00:00
warcificator: limpiar
This commit is contained in:
parent
56a257c389
commit
1abd98724d
1 changed files with 1 additions and 56 deletions
|
@ -1,13 +1,6 @@
|
||||||
use async_channel::{Receiver, Sender};
|
use async_channel::{Receiver, Sender};
|
||||||
// use lol_html::{
|
|
||||||
// element,
|
|
||||||
// html_content::{Element, TextChunk},
|
|
||||||
// text, ElementContentHandlers, HtmlRewriter, Selector, Settings,
|
|
||||||
// };
|
|
||||||
use rusqlite::Connection;
|
use rusqlite::Connection;
|
||||||
use serde::de::value;
|
use serde::de::value;
|
||||||
use tl::VDom;
|
|
||||||
// use scraper::{Element, Html, Selector};
|
|
||||||
use std::{
|
use std::{
|
||||||
borrow::Cow,
|
borrow::Cow,
|
||||||
env::{self, args},
|
env::{self, args},
|
||||||
|
@ -15,6 +8,7 @@ use std::{
|
||||||
ops::Deref,
|
ops::Deref,
|
||||||
time::{SystemTime, UNIX_EPOCH},
|
time::{SystemTime, UNIX_EPOCH},
|
||||||
};
|
};
|
||||||
|
use tl::VDom;
|
||||||
use tokio::io::{stderr, AsyncWriteExt};
|
use tokio::io::{stderr, AsyncWriteExt};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
@ -102,37 +96,6 @@ struct PrecioPoint {
|
||||||
// println!("n={}", i);
|
// println!("n={}", i);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// fn extract_first_text(
|
|
||||||
// output: &mut Option<String>,
|
|
||||||
// ) -> impl FnMut(
|
|
||||||
// &mut TextChunk,
|
|
||||||
// ) -> Result<(), Box<(dyn std::error::Error + std::marker::Send + Sync + 'static)>>
|
|
||||||
// + '_ {
|
|
||||||
// move |el| {
|
|
||||||
// if *output == None {
|
|
||||||
// *output = Some(el.as_str().to_owned());
|
|
||||||
// }
|
|
||||||
// Ok(())
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// fn extract_first_attr<'a>(
|
|
||||||
// output: &'a mut Option<String>,
|
|
||||||
// attr: &'a str,
|
|
||||||
// ) -> impl FnMut(
|
|
||||||
// &mut Element,
|
|
||||||
// ) -> Result<(), Box<(dyn std::error::Error + std::marker::Send + Sync + 'static)>>
|
|
||||||
// + 'a {
|
|
||||||
// move |el| {
|
|
||||||
// if *output == None {
|
|
||||||
// if let Some(value) = el.get_attribute(attr) {
|
|
||||||
// *output = Some(value);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// Ok(())
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
let mut args = args().skip(1);
|
let mut args = args().skip(1);
|
||||||
|
@ -328,24 +291,6 @@ fn parse_script_json(dom: &VDom, varname: &str) -> Result<serde_json::Value, Fet
|
||||||
.map_err(|_| FetchError::ParseError("Couldn't parse JSON in script"))?)
|
.map_err(|_| FetchError::ParseError("Couldn't parse JSON in script"))?)
|
||||||
}
|
}
|
||||||
|
|
||||||
// fn parse_script_json(html: &Html, varname: &str) -> Option<serde_json::Value> {
|
|
||||||
// let template_sel = Selector::parse(&format!(
|
|
||||||
// "template[data-type=\"json\"][data-varname=\"{}\"]",
|
|
||||||
// varname
|
|
||||||
// ))
|
|
||||||
// .unwrap();
|
|
||||||
// match html.select(&template_sel).next() {
|
|
||||||
// Some(value) => match value.first_element_child() {
|
|
||||||
// Some(script) => match serde_json::from_str(&script.inner_html()) {
|
|
||||||
// Ok(val) => val,
|
|
||||||
// Err(_) => None,
|
|
||||||
// },
|
|
||||||
// None => None,
|
|
||||||
// },
|
|
||||||
// None => None,
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
fn now_sec() -> u64 {
|
fn now_sec() -> u64 {
|
||||||
let start = SystemTime::now();
|
let start = SystemTime::now();
|
||||||
let since_the_epoch = start
|
let since_the_epoch = start
|
||||||
|
|
Loading…
Reference in a new issue