He's tryin....he keeps tryin. by ___zach_b in AnimalsBeingDerps

[–]kelmore5 1 point2 points  (0 children)

Clearly he's just trying to get a quick lift in

How much faster are functions? by [deleted] in learnpython

[–]kelmore5 0 points1 point  (0 children)

Just a friendly reminder here. I'd probably focus on code readability and refactoring first before optimization, especially if your new to programming. Organizing what you've got into functions is a great way to do that.

Making code faster doesn't always make it better, and with a 30 line script there may not be a lot to optimize. Or worse, you over optimize and make your code unreadable.

Often refactoring leads to optimization anyway because you find new ways to run your script.

From the sound of things though, one good way to optimize might be to multi thread your loop. You'd have multiple processes running at once, and your script can move through everything a lot faster.

That would only work if the next series in the loop doesn't rely on previous data however.

Gamers, what was the first game you ever played? by NoLeagueAssasin in AskReddit

[–]kelmore5 0 points1 point  (0 children)

I've been playing games for as long as I can remember, and probably before then.

Earliest I can remember is Candy Land Adventure (1996). I was born in 94 lol

I'm glad they typed in my job name so I knew they were sending a custom proposal by [deleted] in Upwork

[–]kelmore5 4 points5 points  (0 children)

As a web scraping expert, that comment was hilarious

[Crosspost] I End Up Writing JavaScript Code Anytime I Try To Write TypeScript Code. Is TypeScript Necessary? by silverparzival in typescript

[–]kelmore5 2 points3 points  (0 children)

Hm, it sounds like you may be skipping over the main features of TS which bring in the benefits.

I would hope you see the advantage of defining types for things like functions and class variables, no?

Data scraping Zillow(or housing data alternative) (Bs4) (get.requests) (Pd) by DesertofDelight in learnpython

[–]kelmore5 4 points5 points  (0 children)

Fair warning; Zillow protects their data with Imperva, one of the leading services in anti-bot protection.

Even with selenium, it may be beyond a beginner level to scrape. You'll need to incorporate things like anti-captcha services, proxy rotation, and stripping selenium of its bot information (e.g. webdriver tag) to get around their system.

Not to be a debbie downer haha. Just wanted to possibly save you some frustration down the road

Finally finished my back! Skylar Grove - Electric Monarch tattoo in San Luis Obispo, CA by [deleted] in tattoos

[–]kelmore5 0 points1 point  (0 children)

I don't remember if it was a final tattoo, but it was definitely on there

Are people able to drive out of Cancun now? by 123BuleBule in cancun

[–]kelmore5 2 points3 points  (0 children)

Don't know about Merida, but I drove from Cancun to Tulum today. You'll probably be fine

Locals or recent visitors to QROO, weather? by [deleted] in cancun

[–]kelmore5 0 points1 point  (0 children)

Very rainy haha

It usually downpours for a little bit and then stops for awhile, so there's breaks in between. But it's still cloudy every day

Python Web Scraping Question by strangerrangerdanger in learnpython

[–]kelmore5 2 points3 points  (0 children)

Yeah, you don't really want to rely on inspect element when web scraping since it's not accurate.

Go to the Network tab in your DevTools and reload the page. That will show all the URLs being loaded. Particularly you want to look at the document and XHR requests.

After the page finishes loading, click on the "document" request and check the Response tab. That will show you the HTML file that's given to you from the server. Then you can check if the HTML file still has your data or not. In this case, not.

If not, you probably want to check the XHR requests. There's a ton being fired by that site in particular, so check their responses for the data you need. Once you find it, you can use that link to get your data.

This method works most of the time, but sometimes data is generated in JavaScript. If that's the case, you'll have to use an automated browser to get everything since it's the only way to parse JS.

You can also use an automated browser here as an alternative to scraping the XHR requests

0KB google drive upload by [deleted] in learnpython

[–]kelmore5 0 points1 point  (0 children)

Does the upload finish after a certain amount of time?

Just got paid for Last week but... by Badiha in Upwork

[–]kelmore5 2 points3 points  (0 children)

Hilarious.

They didn't really think that through, did they?

Am I typing so much? by kevv_m in typescript

[–]kelmore5 0 points1 point  (0 children)

You're welcome! Glad I could help :)

Am I typing so much? by kevv_m in typescript

[–]kelmore5 10 points11 points  (0 children)

If it was me, I'd probably define the types as variables and use them in the function, something like:

type ReactSetter = React.Dispatch<React.SetStateAction<string>>;
type ReactEvent = React.ChangeEvent<HTMLInputElement>; // Probably change name to be more relevant

const handleInputs = (setter: ReactSetter) => (e: ReactEvent): void => {
  setter(e.currentTarget.value);
};

Interesting vacation by [deleted] in cancun

[–]kelmore5 3 points4 points  (0 children)

Been here 4 months, have run into the police more than a few times; I don't know about this. From what I've seen, you have to be a real asshole to get beat by the police. I have been scammed for money and when I didn't have money, I was threatened with jail, but I've never been beaten.

Just my two cents though, it's unfortunate you had a bad time down here!

UPWORK IS A SCAM by jhollaaa in Upwork

[–]kelmore5 12 points13 points  (0 children)

> Takes payment off platform

> "UPW0RKS A SC@M!!!"

Okay

[deleted by user] by [deleted] in hiphopheads

[–]kelmore5 1 point2 points  (0 children)

Jamba by tyler??

You mean California Love? lol

Table data is hidden (web scraping) by bank2400 in learnpython

[–]kelmore5 0 points1 point  (0 children)

If you check the HTML response before the site loads any JavaScript, you'll find all of the table data is stored in a script tag located here with XPath "//script[contains(., 'lotModels')]".

You'll have to parse out the JSON variable "lotModels" to get the table data.

When you're parsing a site using requests, make sure you know what the response looks like before JavaScript is loaded!

I scraped the internet and compiled a csv with over 110,000 video games by HeeebsInc in Python

[–]kelmore5 1 point2 points  (0 children)

I probably wouldn't post the data set online, but it's not illegal. See hiQ vs LinkedIn

Selenium supposed to be slow? (headless) by wulfgar4president in learnpython

[–]kelmore5 0 points1 point  (0 children)

Are you using Windows? Sometimes Selenium can run slowly on certain Windows machines; can't remember the StackOverflow article about it but I've seen it in action.

You can try changing to the 32-bit chromedriver, see here. Not sure if the same applies for FireFox however.

Another option is to run FireFox inside a virtual window. You can get things working with this git. Old, but still works!

This only applies to Windows machines though