Python Scrape Website loading JS [closed] - javascript

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I'm very new to python and programming in general but have enrolled in a few courses to improve my knowledge. It seems it's quite important to have a 'goal' in mind when learning and one of mine is to successfully scrape and manipulate sports data.
I would like to scrape the results from https://www.britishhorseracing.com/racing/results/ but it looks like it's dynamically loading data via JS:
There looks to be a LOT of data here, results going back ~20 years plus multiple races for each racecourse on the day. From what I've read, selenium and beautifulsoup may offer some solutions here but before I start experimenting I wanted to check with you guys how realistic this goal is/ whether it's even achivable with how the website is structing the data and some pointers for how to get started?
Any help would be hugely appreciated.
Thanks

I'm not too familiar with Selenium or BeautifulSoup, but there are other JavaScript related web scrapers. Some I know are NightmareJS, PhantomJS, and ZombieJS (All horror related haha). NightmareJS runs off of and electron Chromium instance, PhantomJS is a javascript wrapper for selenium, and zombiejs is a raw node solution. I personally would recommend using NightmareJS.
However if you need to run NightmareJS on a server that is a whole different ball park. NightmareJS requires there to be graphics interface. There are modules that allow NightmareJS to be ran on a terminal instance however. If would would rather avoid that, then you should be fine installing PhantomJS on the server and use that.
With nightmare JS there is a scroll option that probably would trigger the rest of the data to load.
Here is an issue found of github. Some solutions are provided there.
If you would rather still use something like selenium or python, I'm pretty sure there ought to be some documentation describing how to scroll a page.
I was originally going to say you could use the API network call that BHA does by looking in the developer network tools, however looking at the API quick you need some authentication with the API.

Related

Using Electron with Python application [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I am trying to make a cross platform desktop app based on Python.
I've been looking for Python GUI Frameworks such as PyQT, wxPython, tkinter, and kivy. However, none of them could provide a good look and feel for desktop GUI except for PyQT, but PyQT is quite expansive for commercial use, and I do not want to open my sources. In addition to that, making python GUI installable seems pretty hard that I fail to make installable program so many times. So I am now looking for something else which is Electron.
I've found that Electron's NodeJS can run python app using python-shell. Also, Electron is being used pretty well and has many famous products, so I thought it can be a good choice.
My concerns are, is it a good way of developing a cross platform desktop app in this way? Though I am familiar with Html, CSS and some JS, I am not familiar with NodeJS. But since this is kind of a work around, I am worrying this could make a lot of overhead or create bad user experience.
My python app contains quite a lot of mathmatical tasks. Not super heavy, but still kinda heavy using many regressions. Also using SQLite for internal database.
Of course, the best solution would probably be using NodeJs instead of running Python in NodeJs, but concerning the time to develop everything again in NodeJS, I thought this could be more practical. If this approach slows the program significantly, perhaps I have to find another way.
So in summary,
Is it a good idea to make a cross platform commercial app with quality using Electron and Python?
Does it affect the app's performance significantly?
If it is a bad idea, is there any alternative or recommendation?

Similar and simplified examples (newbie questions) [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I'm currently studying about web development, I still don't know about jquery, but I've a little knowledge about javascript, html and css (basic).
I've been looking at some examples in github to improve my skills, and I've found this content;
https://github.com/stewilondanga/editables
I perfectly understand the theory, but I do not know how to put it into practice, I would like for any similar examples (simplified alternatives) and how to convert the exported code generated by javascript into a html5 table?
Any example would be appreciated! thanks for your attention!
First of all, jQuery does not generate code. It's a framework, you load it into a web page, and then you can use it from within Javascript code in that page.
I suggest you start by looking at the source of https://stewilondanga.github.io/editables/, if an editable tables is what you need. There are more general frameworks to do this, e.g. Aloha
To try it yourself, I'd suggest you bite the bullet equip yourself with some kind of web server, be it on a server somewhere, or on your local machine, so you can easily try out things like this, copy the sources, alter the code etc.., and quickly hit reload on your browser.
While it may seem easier to run a local server and point your browser at http://localhost/something, IMHO it also takes more tinkering to get browsers to embrace that fully. You don't need the extra grief while already learning all those new concepts. If you want to tackle this seriously, consider getting a hosting service or small VPS somewhere. If you don't know how to do that, get help for that first, but get it out of the way. It'll save you much grief.

How to best analyze and understand the .sln file I've been given? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I've been handed off a rather complex web app from a prior developer with whom I have no way of communicating going forward. My experience in development is still beginner, and I need to determine the best way to wrap my head around what is going on with this app.
I've been given the full .sln file. I am very comfortable with the basics of navigating Visual Studio. I was trained in C#, but this app contains several additional components that I'm still learning (js extensions, cshtml files). I know the answer is to learn what I don't know, but I'm under a tight time constraint for my employer. What I mainly want to be able to do to start is be able to get to the underlying code of any given functionality within the UI of the web app, e.g. there is a button called "Perform a Test Run" - as simple as it should be to navigate to the underlying code that is run when that button is clicked, I can not seem to locate it. It's certainly not where I expect it to be for the way I was taught.
I tried an app called NDepend to run an analysis but that wasn't helpful to me, unfortunately.
Can anyone suggest a tool or an approach for me to start understanding how this all works together? There are almost no developer comments within any of the code.
I don't know if this helpful, but here is a screenshot of the top-level of the solution to see what different kinds of components are included. The 2nd image is the Scripts folder expanded.
This solution is for an ASP.NET MVC project. The files you are not familiar with (.js, .cshtml) are very common and frequently used file extensions for MVC projects.
".js" files are Javascript files
".cshtml" files are files that are html and/or Razor syntax.
The good news is, ASP.NET MVC is one of the best ways of making web applications currently, and learning it is fairly straight forward and not too daunting. Especially if you say you have familiarity with the concept of MVC.
I will direct you to a few key resources:
This is Microsoft's MVC portal with tutorials and documentation
This is a great Pluralsight course on some MVC5 fundamentals

UWP BTLE Application [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am trying to make a BTLE App using UWP in JS. I cannot find any examples and I cannot understand the documentations. Can anyone help me out and point me in the right direction as to from where should I begin?
In using VS2015 Community Edition w/ Windows 10 SDK Build 14393. My phone is also 14393 so is my PC. I can compile the app but I don't know from where to begin.
EDIT:
The way the docs are, is quiet confusing. Like in this page this is an example.
var bluetoothLEDevice = device;
This does not state where this this device variable came from, it took me a while to file the link between this and the BluetoothDevice Class but still it was unclear on how I am supposed to use it. There are no code blocks to liked in the page. Microsoft maintains a GitHut hub account so it will be great for NEWBs like me to see a working example or related example for all the supported languages on GitHub (I know it's a lot, but Microsoft is a big cooperation so it is possible), linked on the Class pages.
Thank you for understanding what was I trying to say #Grace Feng - MSFT.
I cannot find any examples and I cannot understand the documentations.
If you're asking for one official UWP BLE sample which is wrote in JS, I'm afraid to tell you that there is no such one.
By not understanding the documentations, you mean you don't understand the code sample in those documents? We don't know that blocks you, next time when you ask a question, you'd better share us your code the point what exactly the problem is.
I can compile the app but I don't know from where to begin.
To get started, I think it's better to stick to the official document Bluetooth GATT and the official Bluetooth Low Energy client sample, you can try to adapter it to JS code, what you need is checking the js Apis which are used in those samples, for example GattCharacteristic class.
The official Bluetooth advertisement sample has a code sample in js version, it demonstrates use of the Bluetooth Advertisement Runtime API to send and receive Bluetooth Low Energy advertisements. Maybe you can also take a look to get started.

Is there a prebuilt website with logins I can work from? (Just starting to use javascript) [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I need to build a website that allows users to upload files and a few other actions. I have zero experience with javascript so I was wondering if there was some type of built site that already had logins coded so I could just work on the other logic?
I'm a long time delphi developer so I'm not new to programming. Any javascript video references would be great as well.
Thanks in advance.
You don't want to be handling logins with plain-old JavaScript unless you start building a super cool NodeJS setup, which, I wouldn't recommend if you have zero experience with JavaScript.
To ease your JS adventure, check out JQuery.com which makes it easier to code JS without worrying so much about browser quirks.
For easy server-side login, I recommend PHP since there are literally millions of tutorials and free code snippets out there, hosting is cheap, and an enormous community of PHP developers online to help you. To ease your PHP adventure, start with a framework such as CodeIgniter.
To answer your question, here's an example of a PHP + JavaScript (JQuery) login solution: http://blog.webwizo.com/2011/05/04/simple-login-with-php-and-jquery-ajax/
In order to upload files, you'll need a server-sided script, possibly done in PHP.
As for communicating with the server, it can be somewhat daunting for a beginner, but it's largely done via xmlhttprequest (otherwise known as AJAX).
Here's a tutorial on how to use it by W3CSchools, but there are plenty more on the net: http://www.w3schools.com/ajax/default.asp
One word of advice; don't make the mistake of relying of a JS library too soon; familiarize yourself with the language and its capabilities. A lot of answerers are just going to say "Use JQuery." You can (and possibly should), but it's important to know how Javascript works without it.

Categories

Resources