dontblink

joined 1 year ago
 

Hi! I'm trying to learn Rust, as a little project, I'm trying to build a web scraper that will scrape some content and rebuild it with a static site generator, or using it for making POST requests.

I'm still at a very early stage and I still don't know much, the simplest error handling strategy I know is using match with Result.

To my eyes, this syntax looks correct, but also looks kind of a lot of lines for a simple http request.

I know the reqwest docs suggest to handle errors with the ? operator, which I don't know yet, therefore I'm just using what I know now.

fn get_document(permalink: String) -> Html {
        let html_content_result = reqwest::blocking::get(&permalink);
        let html_content = match html_content_result {
            Ok(response) => response,
            Err(error) => panic!("There was an error making the request: {:?}", error),
        };

        let html_content_text_result = html_content.text();
        let html_content_text = match html_content_text_result {
            Ok(text) => text,
            Err(error) =>
                panic!(
                    "There was an error getting the html text from the content of response: :{:?}",
                    error
                ),
        };

        let document = Html::parse_document(&html_content_text);

        document
    }

As for my understanding, this is what I'm doing here: I'm making an http request, if i get a Response, I try to get the text out of the response body, otherwise I handle the error by panicking with a custom message. Getting the text out of the request body is another passage that requires error handling, therefore I use the match expression again to get the text out and handle the possible error (In what circumstances can extracting the text of a response body fail?).

Then I can finally parse the document and return it!

I wonder if it is a correct and understandable way of doing what I've in mind.

Do you think this would be a suitable project for someone who is at chapter 7 of the Rust book? I feel like i actually need to build somethiong before keep going with the theory!

 

Bonus points if it can be activated automatically for certain sites.

I'm tired to find bloated content everywhere.

[–] [email protected] 26 points 9 months ago

It's the path of many of us here, now you will hate linux if you come from windows, give it a couple of months and you'll ask yourself how the fuck you could be on windows till now.

[–] [email protected] 1 points 9 months ago (2 children)

I wonder why we don't have AI browser extensions that can recognise and obscure possible ads / unwanted content yet

[–] [email protected] 1 points 10 months ago

I will add another amazing alternative i've found, currently working great: https://www.distractionfreeapps.com/ This was exactly what i was looking for.

[–] [email protected] 28 points 10 months ago (3 children)

What about sexual and emotional education in schools?

[–] [email protected] 1 points 11 months ago

Yeah sure, you have to trust your users

[–] [email protected] 6 points 11 months ago

I like Debian with GNOME

[–] [email protected] 4 points 11 months ago (1 children)

Video editing softwares definetely, kdenlive is nothing compared to stuff like sony vegas.

[–] [email protected] 1 points 11 months ago (2 children)

I guess probably, because Matrix is thought for private chatting, i guess someone else might have had this same idea, i think matrix is opensource so there must be some client that does this.

[–] [email protected] 7 points 11 months ago* (last edited 11 months ago) (6 children)

I mean theoretically if you are hosting your own chat server, for example on Matrix, you can easily make all the chats unaccessible from the clients by issuing a command to shutdown your server or simply the chat server service if there's no content cached locally.

I think you can do this pretty easily with a raspberry pi by connecting via ssh..

Just use a shell script that changes the static ip to something else after the command to shutdown the service/wipe out the data (depending on what your goal is) has been issued, or use a vpn or something like that if possible, because anyone issuing the command would need to know your server ip.

And issuing a command by ssh to a remote server both from smartphone or pc should be as easy that you can actually build a very small app for that, or use some app that creates shortcuts that directly connects and issue custom commands.

That way you are forced to give people your new ip every time chats become unaccessible/deleted and someone can't connect back even if wanting to without talking to you, unless you decide you can use the older ip for whatever reason.

Of course not using your real ip but using some service like a vpn or proxy (or tor?) would be much better here, but i don't really know how.

That can give you full power on the chat history and create the said "panic button" for every client involved.

[–] [email protected] 4 points 11 months ago (8 children)

TREE STYLE TAB

[–] [email protected] 1 points 1 year ago

I simply backup the /home folder, where the important files are with duplicity on my home server with ftp once a week, keeping records of the last 6 months. But as that only restores the home folder i also take a snapshot (which takes way more disk space) every month with timeshift too, which stays on the pc. Would be great if i could take complete snapshots via ftp just like with duplicity, but timeshift doesn't do that.

[–] [email protected] 5 points 1 year ago* (last edited 1 year ago) (1 children)

The RSS feature is amazing, i wanted to do something like that with RSS Bridge, but it looks like both Instagram and Facebook are doing their best to block exactly these kind of things, so it works half of the times and it needs to be fixed quite often, i think now it doesn't work very well either... Also it is very complicated to be set up if you don't know a bit of PHP. Of course i'm willing to learn but all this blocking that projects like this (see Barinsta or Bibliogram) get is really discouraging. I think Meta content is probably one of the worst to scrape.

Regarding Proxygram: for now it works, i'm using a public istance to grab some RSS feeds, if it proves to be reliable i will be happy to host my own istance as well, if possible :) It's sometimes slow to grab data (i guess because sessions get easily blocked/limited, getting error 500) but not really a problem as i just want to see new events every couple of days, one issue tho is that the RSS doesn't show all the posts (only showing the last three of them), which can be annoying as you may lose something if you don't see it and save it.

EDIT: It actually does get other posts as well, just reaaally slowly, meaning that if you follow really large accounts in a week or so you can find your feed full of older posts marked as unread.

Anyway thanks to whoever is making the hard job of building/owning an instagram scraper, I really know it can be tough.

 

Bibliogram is being discontinued, and Barinsta doesn't work anymore too..

Is there some good soul providing an instagram frontend or app? I really need it to see events, but i don't want to get caught in those useless post suggestions and ads, i just wanna see the content i chose to see.

 

These are the things i care the most: I want a smartphone i can repair on my own (battery and screen are the essential parts), with a bootloader easily unlockable, even better with verified boot / supporting a custom OS with re-lockable bootloader.

I don't care if it's supported by an official foundation or by custom ROMs foundations, i want something that will most likely get the longest term updates and security patches.

Does a device like this even exists?

I know that probably one of the few alternatives here is the fairphone, however it's really expensive and i've read many negative reviews of it (pieces staying out of stock for months or stuff like that), and i can't see the meaning of having a repairable smartphone if i have to spend the same money that i would spend buying 3 smartphones with the same specs that would last me the same time. That said, i know the market isn't favouring these kind of businesses and these devices NEED to be expensive in order to keep existing, but i would like to know some other possible alternatives that satisfy these requirements, if they even exist.

Honestly i've come to a point i would probably prefer spend my money on a guitar instead that on a smartphone and just give up, the industry is terrible 😅

 

From a first perspective it actually looks good! I think these kind of regulation were really needed. But i would like to hear your opinions!

 

The new fairphone 5 came out, it looks cool but the price is really, really high..

If it's a phone that can really last 10 years it could be good, but is that true? Is it worth it? I could get the one with /e/os from Murena because i want a degoogled phone with a bootloader locked, but is it usable on a daily basis?

1
submitted 1 year ago* (last edited 1 year ago) by [email protected] to c/[email protected]
 

Buggy software, not so user friendly, things don't work, new things to learn..

Sometimes you just wanna do a simple thing and you cannot do it and that really undermines your self esteem.

You try to find little working solutions when big techs with armies of engeneers and programmers are working against you.

Aurora store stopping to work, apps getting blocked on lineage os or rooted phones, Reddit cleaning out all those amazing third party apps, Linux that wanna make you destroy your pc at times, Firefox remaining the only real alternative to chromium (only god knows for how long yet), google wanting to DRM everything, ig blocking my account because i was using barinsta (i cannot even delete it), Newpipe getting stuck after 1/4 of the video.

Sometimes you find half of your software stops working and you need to go and understand why, fixing or checking for alternatives..

Is it possible that we have from one side mass tracking and surveilance and from the other a (sometimes understandibly quite not organized) series of freely mainteined software.

Can't we just find a new way of monetize stuff without ads? So that we can build really nicely working software without all the shit that comes from the need of having to track the user? Are there real alternatives? We need to get organized and actually starting to build a better web and software, but i really think an economical incentive is still very much needed for it to be stable and usable by everyone.

Sorry this is more of a rant than a real post, sometimes everything really gets frustrating and you have to deal with much more serious shit in life that doesn't leave time for checking out why your Newpipe, your gps or home server doesn't work..

 

I wanna buy an ebook reader but i don't want any amazon or other companies shit in there, just something i can connect to my pc, pass ebooks in different formats into it and read.

 

I see i can find a foss version on f-droid, and that's something not a lot of social networks can have, i don't really like all the crypto bullshit and ads testing they've been up to lately, but still looks better to me compared to what Reddit have done lately or what other platforms have done in these years..

I don't know about their privacy feature, but i wouldn't trust their chat as for as far as i knew they were not end to end encrypted some time ago (except for secret chats).

Anyway it still looks like one of the at least still decent platforms out there, or am i wrong?

 

I've been using linux for some time now, i would still say i'm quite a noob but i've tried different desktop environments, for my experience i found GNOME to always be suited for me, anyway i heard many good opinions on KDE and i would love to try that too, i've tried cinnamon before and couldn't really see myself using it, i've seen Kubuntu and looks quite lovely, what's in your opinion the distro that best implements KDE on Debian or preferably Ubuntu?

view more: next ›