Call Scrapy / Scrapyrt with web form - web

I'm trying to make a web form that calls a scrapy using scrapyrt. but I come up against a problem: when I send the command it goes to the end, I mean, when I close the broswer, the spider stop.
Does anyone know something I can implement a web form by calling a spider?
thank you all.

ScrapyD can fulfill your requirement. Here is how to install it
Once installed, go into your Scrapy's project root folder, and run scrapyd-deploy, it will deploy your project on ScrapyD.
Then do this command to run your scraper.
http://localhost:6800/schedule.json?project=default&spider=yourspidername

Related

How to call Node JS CLI command from web app?

I'm using this Node JS script to scrap videos from tiktok. To use this script you have to run command via terminal.
Nothing done for the moment apart using the script via CLI as i'm still trying to figuring this out.
Now i'm wondering how could I could implement this into a webapp as UI.
I've been thinking
installing the library on a webserver
making an api to to communicate with this webserver to run the command.
make my html/js or whatever to call the api
I dont if it's the best approach, i mean nodejs is supposed to be use from webserver but i dont know anything about ..
Thanks

Calling/Executing "UIVERI 5" by pressing a button / calling a function from a website

I have developed some test cases using the JS framwork "UIVERI5" and execute those by running
UIVER5
in the terminal / console. Now I want to execute those test cases by integrating them into a website.
For that I am using the JS framework Angular (could switch to others). Both frameworks, UIVERI5 and Angular are installed in the same project folder and can be started seperatly using the terminal.
How is it possible to execute UIVERI5 within the runtime of the website?
Any suggestion or cluse would help.
Best regards
If anybody is wondering about that in the future:
I have found no way to start "UIVERI5" from the website.
Possible solution is to start "uiveri5.js", but I have not accomplished that.
I have switched to electron, as there is the possibility to start shell scripts.

How Do I Execute System Scripts from Within a Reactjs Project?

I have a React project where I want to execute a server side bash script when a user clicks a button. This script would then run and return some output to be displayed back to the user. I know that NodeJS has a way to spawn or exec a particular command, but I'm not sure how I can take advantage of these features inside my React project.
Does anyone know how to accomplish this?
What you can do is create a web service, that you will call with your React JS application. This web service will execute the script directly on the server and when it's done you can return data to display on your React JS application.
React runs in the browser, and with a purely remotely-served website there is no direct way to run a client-side bash script (that would be a major security issue). To run a bash script you need to run a native application on the client, which could then connect directly to your back end or be triggered via the nativeMessaging API. Alternately you could use a framework like Electron or NW.js to turn your React app into a native app, rather than running in the browser.

Running UI5 on Node JS server

I'm trying to run my ui5 pages on Node.js server. What I've done till now is created a UI5 project with a simple index.html file calling my other ui5 views showing a text message. When I run it without node js it runs fine and shows me the message.
What I'm trying to achieve now is run this on top of my node server. So I've configured a server.js file for my node and it starts up fine. In there I'm calling up my above index.html file. it calls it fine but it gives an error inside it saying sap is undefined meaning it is not able to find my ui5 resources like sap-ui-core.js and thus the error. I'm not sure why it is not able to find it.
I've created the ui5 project using eclipse which provides me the ui5 resources under the below directory but even if I try to put the resources directory under the web content directory it is not able to find it.
After manually putting resources directory:
Below is how my index.html looks like:
Has it got something to do with the resource root that I define or please if you can suggest how can I get it working.
Awaiting your responses eagerly.
Thanks,
AW
Adding to cschuff response:
Hello, thanks for taking time to help me out. Yes my apps namespace is different and definitely not something with sap.ui. Though I've got a way around of getting it to work but still would like to get this to work as well as it is much cleaner. The way I've got it working now is by creating a seperate node project altogether and then gradually adding my UI5 pieces to it and by gods grace it is running fine now. But I'm not sure why the same concept if I apply on a UI5 project created in eclipse, it gives me sap is undefined error.
My only suggestion that you misconfigured node.js server. Try start from scratch:
mkdir app
cd app
npm install -g express-generator
express -f
npm install
node .\bin\www
Than put all of your files of your project and resource in public directory. And try to open http://localhost:3000/index.html
The /resources are delivered by the com.sap.ui5.resource.ResourceServlet (see your web.xml; web.xml and Servlets are used in the Java World e.g. by Java Application Servers or Servlet Containers like Tomcat)
The ResourceServlet listens on the url-pattern /resources/* meaning every time a request is send to an url matching this pattern the ResourceServlet (a Java class) will step in, look up the right .jar file and return the required JavaScript file from it. This won't work with a plain web server like Apache.
I don't know much about express but I guess it is not able to run Java Servlets and thus is not able to deliver your SAPUI5 resources the same way Tomcat does.
To work around this you still have some options:
Use Express to serve your application sources and load UI5 from Tomcat while developing. This might lead to cross-origin problems (since localhost:8080 and localhost:3000 are considered different origins)
<script src="http://locahost:8080/resources/sap-ui-core.js" ...
Unpack all the UI5 .jars you need and place them in YourApplication/resources/.
BR
Chris

Start app on mac os directly after installation

I'd like to know if it is possible to create a dmg file which can be installed by Drag&Drop - and which starts directly after this installation without having to be called manually again.
And if this is possible, I'd like to know whether I can pass arguments to the (nodejs) process which will be started directly after the installation.
I managed to pass parameters to the process when I call it manually after the installation, but I want to run it directly.
Any help will be appreciated!
Thanks!
I solved it: Instead of creating an app and wrapping it into a dmg, I created an app and wrapped it into a pkg. For pkgs it is possible to use postinstall scripts, so I started the application through this script.

Resources