Bugswriter / tuxi

Tuxi is a cli assistant. Get answers of your questions instantly.
GNU General Public License v3.0
1.33k stars 73 forks source link

Optimized code #130

Closed BeyondMagic closed 3 years ago

BeyondMagic commented 3 years ago

To test this code, just do

git clone https://github.com/BeyondMagic/tuxi.git bmtuxi
cd bmtuxi
./tuxi "linus torvalds"
./tuxi ".............."

The code was simplified using a function to scrap the HTML, it's very simple.

Genghius commented 3 years ago

if we are going function, I would prefer every scrap to be its own function.

Bugswriter commented 3 years ago

Nice I was waiting for this. This is even better than the current develop branch snipcall function. Does it pass all the tests? Did you test everything properly?

Bugswriter commented 3 years ago

@Genghius yeah .. you are right every scape being it's own function. But it depends on how many features we want? I guess we will end up with hardly 15-20 features max. and This function @BeyondMagic removing the redundancy in code. I guess we can extend like the way you proposing different functions for different feature.

Genghius commented 3 years ago

yeh, maybe i'll turn eerything into functions with my next PR, passing this one will help lots.

BeyondMagic commented 3 years ago

@Genghius yeah, I did this thinking in portability, it's way easier to maintain the script with the code like this, at least for someone who uses only a few features, this should help disabling and enabling them.

@Bugswriter I did test everything, even though there's no changes at the scrapping itself, and it worked as far I as remember, but I left a "mini tutorial" there to hope that you guys would test it out before merging.

Bugswriter commented 3 years ago

I will look into this and merge soon

sudocanttype commented 3 years ago

Just ran the testcases on my end (US), and everything looks good. testoutputs.txt

Bugswriter commented 3 years ago

Cool I am merging this.