How to parse webpage response in android? - javascript

How do you make it so that if a website has a form let's say, and I want to pass a string into the input tag , press a button, and get the link that's generated in the other page? All of that meaning it should be done in the background, with javascript or somehow. The website in particular is http://www.listentoyoutube.com/ , I want to get the generated audio file link.

I think it's not possible, you should look for another site that supports APIs to do such requests.

Related

Getting Input From HTML And Storing It In A File (Static Website)

I am trying to make a simple form submission in a GitHub Repository.
Basically what I want to do is take the input of an HTML Tag and then store it in another local file such as another HTML file or a text file without a back-end.
I understand that there was a saveAs function within JavaScript (however I read that it had been discontinued due to security reasons). Once I get the data stored in a file I would call it in the HTML page with the < embed > tag to show it on the page. So basically I want the Input on the page, and then when it is appended to the file, to show up on the same page again when the page is refreshed. My reason for doing this is to make a make-shift Google WorkSpace-like page for my production studio.
Here's a visual of what I want to do:
HTML PAGE:
Embedded File Contents (externalfile.html) Go Here.
Input: Input Goes Here
Submit
When Submit is pressed, it takes the contents within the "Input Goes here" box and appends it to "externalfile.html", then when the page is refreshed, it shows the updated content above the form.
I am not well-versed in JavaScript but I know JQuery a Good bit from making a few websites with Wix, but I do not know much native JavaScript nor it's functions. Any advice would be helpful. :) Thank you. I would be adding multiple input boxes and such on the page.
Hello and welcome to StackOverflow!
Now, if I got your question right, you want to append something to a file and read this file without using any backend? Then I must disappoint you, because there is no way JavaScript allows this, since it would be a tremendous security risk. The reason is, because any malicious JavaScript code on any webpage then could not only create malware files on your PC and dragging it to some start up folder, but also they would be able to read all the files and documents on your machine (without your knowledge!). So I think you see where the problem is.
For your task I recommend you using some kind of backend (i.e. NodeJS, PHP) and make things work with API requests and asynchronous JavaScript. Or you could serve your site with an ExpressJS backend and statically fetch the request and append its contents to a file. Then of course send an HTML file back with all the inputs the user made. The choice is yours.
Cheers

How to scrape info from a specific page of a website that has a single URL for multiple pages?

I am trying to write a program that automatically clicks on certain places based on what is displayed. The website I am trying to do this on is Gimkit. I am using a python web-scraper and auto-clicker to perform this task. The problem I am running into is that the player side URL is the same, no matter what html is loaded. This leads to the scraper only getting the html for the first page, which is the game PIN page. This means that my scraper is getting no useful information and is simply stuck. When I fill out the information on my device and check the URL, it is the same. There is no difference in the URL when I am entering the PIN or playing the game, but when I inspect element, it obviously is different html. Right now, I am using Requests, BeautifulSoup4, and lxml to get and format the html from the site. How can I access the html for the gameplay page instead of the PIN page?
Related: How can I keep the same url in the address bar for every page?

have python script send data to javascript using JSON to change web page

I am working on an interactive display with sensors on a raspberry pi. My display is showing a webpage. I am using a python script to interact with the sensors. I want it so that when a user walks by, a different web page is displayed in the web browser. I have already tried changing to a different web page doing it straight from the python script. Unfortunately, it does not work the way I want it to. JavaScript works just fine for changing to a different page. I am thinking it might be good to have my python script send a message to a javascript file to change the page using JSON. Does this sound like a practical solution? Thanks.
Create your html file as a string in python. This string can be modified in response to sensor input. Write it to a file on your system where the html is source file exists; rewrite each time the sensor inputs change. Set up a timer in Javascript, e.g. setTimeout() to refresh the page often.

Write to external webpage using javascript

I have a website written in html and javascript/jquery. How can I follow a link to another page(outside my origin--> lets pretend google.com) and automatically enter data into a form and submit it on the outside page?
For example, I want to follow a link on my page to google.com and then have the browser enter info into the search box and make a search.
Selenium?
It's impossible unless the page you are working with has set up GET or POST options that allow you to do such things. There may be other methods, but the page you are working with must first set it up and allow it.
For example, you can run a Google search by appending a q parameter to the URL like so. You can do this because Google uses GET parameters which are easy to determine.
https://www.google.com/q=stackoverflow#safe=off&q=stackoverflow

display external text from txt, html etc. (hosted on cloud) on web page

I manage a small web page for a relative's business. They want to provide notes on the page for the visitors regularly (opening times, news etc.) but cannot code the web page themselves.
Is there a way to embed a news scroller, text field, whatever on the page - however, the text displayed there then comes from an external source they can manage like a htm, txt, json (whatever) file hosted e.g. on their Google Drive that they simply need to change and see the edits directly in the web page (the file would be public; the URL to be embedded in the web page code).
Is there a solution or an easier way to achieve it? thx
You can use file_get_contents() if I got you right.
To achieve this, first you need to create a portion on the website to display the news or whatever external dynamic content you want.
Then you need to develop complete APIs for that site and then hit them from your website (Keep a secret key for safety). Your API can do everything you program it to do. (E.g You can put the news in database or create publicly accessible files through it)
When this is achieved, you can then fetch the data into the portion created for news etc. (automated through programming)
Using PHP you can achieve all the above mentioned steps.
That way you will just have to push/send the data from your APIs and the actual site will keep getting updated without any further action required.
Hope that helps.
If they can write the HTML and make it available at a public URL, you can simply embed it using <iframe> in HTML.

Categories