r/CodingHelp • • Mar 26 '22

[Request Coders] Programming a bot to click the NEXT button on my TV show watching website as I fall asleep

15 Upvotes

I love to watch shows before I go to bed on an undisclosed site, however the site does not offer autoplay. I need autoplay because I want the show I'm watching to continue playing, episode after episode, after I fall asleep. I know a small bit about coding in javascript and html, along with some experience with Java and c#. I am not entirely sure how to get started, and I was looking for some help with it. There's only one thing I need my program to do, and that's click the NEXT button on the screen every time the episode ends so that it continues playing the series. How would I go about starting this? I don't need the whole project done for me, as I want to learn a little bit, but I do want to learn how to get started.


r/CodingHelp • • Jan 03 '22

Python: Amazon web scraper has suddenly stopped working, after changing nothing

15 Upvotes

I am a 14 year old who is learning python and I am making a simple amazon web scraper to collect the title and price of all the search results (in this case a camera). I am using Beautiful Soup 4 and Requests. After many hours of work, I finished with the work below, which was working. However, after doing something else for a few minutes (unrelated to code), I came back to the program to find it stopped working. Now, the links in the scrapeResults function returned an empty list, despite me not changning anything. This has broken the program, and I cant fix it. Any help would be appreciated.

Code:

from bs4 import BeautifulSoup
from time import sleep
import requests


def makeSoup(url):
    headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36"}
    loop = True
    while loop:
        try:
            page = requests.get(url, headers=headers)
            loop = False
        except:
            print("Connection refused by the server.")
            print("Sleeping for 5 seconds...")
            sleep(5)
            continue

    soup = BeautifulSoup(page.content, "lxml")
    return soup


def scrapeResults(soup):
    links = soup.find_all("a", class_="a-link-normal s-link-style a-text-normal")
    print(links)
    for link in links:
        href = link.get("href")
        url = "https://www.amazon.co.uk" + href
        s = makeSoup(url)
        data = scrapePage(s)
        print(data)


def scrapePage(soup):
    try:
        title = soup.select_one("#productTitle").text.strip()
    except:
        title = ""
    try:
        price = soup.find("span", class_="a-offscreen").text.strip()
    except:
        price = ""
    data = {"title": title, "price": price}
    return data


def main():
    NAME = "camera"
    URL = "https://www.amazon.co.uk/s?k=" + NAME
    soup = makeSoup(URL)
    scrapeResults(soup)


if __name__ == "__main__":
    main()

r/CodingHelp • • Nov 08 '21

[Random] Is there a way for 2 or more people to work on the same code remotely?

15 Upvotes

Could my colleague and I work on the same bit of code and effect individual changes in real time? For instance, html?


r/CodingHelp • • Oct 13 '21

[Request Coders] Question on how to start?

15 Upvotes

Just bought 130$ chromebook just wanted to know what I could with it v poor so doin what I can with what I got thank you


r/CodingHelp • • Mar 14 '21

[C++] How to Connect I/O of Logic Gates with Different Return Types

15 Upvotes

Hello! I'm hoping for some help on my current homework assignment. It is in C++, and I have cross posted this in r/cppquestions.

As the title says, we're working with logic gates. I'm using inheritance to write classes representing the different gates. This is a unit test project and I've got four classes: Component, an abstract class, Pin, NotGate, and TwoInputGate. The last three inherit from Component.

I've gotten hung up on how to pass the Pin's output value to the NotGate's input value. NotGate has a shared pointer type input and Pin has a bool type output, leading to a 'no viable conversion' error if I try to pass a Pin through my NotGate's setInput function, or if I try to use a vector to store the I/O and then pass that in. I'm including the code for Pin's getOutput, NotGate's setInput, and the unit test I am trying to pass. Any tips are appreciated!

Pin - getOutput:

bool Pin::getOutput() {

	return value; //bool type private variable

}

NotGate - setInput:

void NotGate::setInput(std::shared_ptr<Component> in) {

	input = in; //both shared_ptr types

}

Test case:

TEST_CASE( "NOTGate" ){

	Pin c("C");

	NotGate n1;

	c.setValue(true);

	n1.setInput(//somehow pass Pin's output here);

	REQUIRE(n1.getOutput() == false);

	}

r/CodingHelp • • Feb 02 '21

[Python] Python help

15 Upvotes

Hey reddit

So I am coding a text adventure game and was wondering, when you die I want the game to start over. I assume that I would need to do a while loop but would I have to paste the WHOLE game code, that just seems like too much haha.

Thanks


r/CodingHelp • • Oct 16 '20

[Java] Why doesn't my code break the while loop?

15 Upvotes

int i = 0;

while(i <= 4){

String waarde = leegofvol.get(i);

String Leeg = "Leeg";

if(waarde != Leeg){

if(waarde == Leeg){

break;

}

System.out.println(k + " " + waarde);

k = k+1;

i = i + 1;

}

}

The code above should break the whole while loop whenever there is "Leeg" in waarde right? Well the output of this code is as follows:

1 Vol

2 Vol

3 Vol

4 Leeg

5 Vol

So it should stop at 4 but it keeps looping and goes on to 5(which is the max in this program). Why does it do that?


r/CodingHelp • • Sep 26 '20

[HTML] Learn lists in html by making projects

15 Upvotes

Link to the video : https://youtu.be/-vIo521LctE

today I'm gonna make a project to enhance your coding skills with lists in html. make to sure to watch the previous video where I teach all the important aspects of lists in html : https://youtu.be/c5406R3PGqc

also make sure to comeback to this video if you ever forget anything about lists and want a reminder.

and please actually write the code your self you cant learn anything just by watching you tube videos


r/CodingHelp • • Sep 19 '20

[Python] Can you design a home using coding in python?

15 Upvotes

My parents wanna make changes to our home and i wanted to see if it was possible to do that through coding. I am guessing through maybe dimensions of our house and if and then statements. i dont really need to know how just if its possible! (Taking a class and the professor asked what wanted to be able to do at the end of the course.)

*edit To make this post less vague, my idea was to have a model of my home with the dimensions of the home and outside. Then create a code that would allow me to input different materials at their specific cost ( 3x5x2 wood @ $....). If im being honest it is just a thought and im brand new to coding and still trying to understand it’s possibilities and limitations. (The way its described makes it seem like it can do everything lol)


r/CodingHelp • • Aug 09 '20

[Random] Maintaining simple game apps (Google Play Store)

15 Upvotes

What does it take to maintain simple indie game apps on the Google play store? Is it something one person can reasonably do with a bit of free time?

I ask because I am thinking of developing my first game, a text based RPG with a complex turn based system. No leader boards or multiplayer functionality. Is this reasonably do-able for me alone after the app launches?


r/CodingHelp • • Aug 04 '20

[HTML] Is MIMO a reliable source to learn how to code?

15 Upvotes

Right now I'm learning HTML on MIMO and I wanted to know if this will be good in the long run?


r/CodingHelp • • Mar 08 '20

[C#] Why isn’t my stuff showing up in the console?

Post image
15 Upvotes

r/CodingHelp • • Jan 26 '20

Calculator loop help

Post image
15 Upvotes

r/CodingHelp • • Nov 26 '19

[Javascript] I'm trying to add and if statement to check if the user selects a product before clicking the submit button but I can't figure out how to make it work. Any advice?

Post image
15 Upvotes

r/CodingHelp • • Oct 21 '19

[CSS] How to draw this pattern in css?

Post image
15 Upvotes

r/CodingHelp • • Jun 24 '19

[C] Please help me writing code for this?

Post image
15 Upvotes