I said it before and happy to repeat again: Either you're using #EmberData / #WarpDrive for managing data in your #JS application or you're building cascade of future traps for yourself.
I said it before and happy to repeat again: Either you're using #EmberData / #WarpDrive for managing data in your #JS application or you're building cascade of future traps for yourself.
Pour obtenir des réponses lors d'une recherche sur le site web d'un journal, le plus simple c'est la requête HTTP GET, qui renvoie une page montrant les résultats.
Sur les 930 sources de #metapress il y a toutefois 2% de rebels qui utilisent une requête POST à la place.
Mais il y a également 5% de modernistes qui passent par une requête #XHR lancée par le JavaScript de la page.
Et pour 3 cas sur 930 le JSON il contient… du HTML mis en forme ! #JavaScript
“Lazier” Web Scraping is Better Web Scraping
Ever needed to get data from a web page? Parsing the content for data is called web scraping, and [Doug Guthrie] has a few tips for making the process of digging data out of a web page simpler and more efficient, complete with code examples in Python. He uses getting data from Yahoo Finance as an example, because it's apparently a pretty common use case judging by how often questions about it pop up on Stack Overflow. The general concepts are pretty widely applicable, however.
[Doug] shows that while parsing a web page for a specific piece of data (for example, a stock price) is not difficult, there are sometimes easier and faster ways to go about it. In the case of Yahoo Finance, the web page most of us look at isn't really the actual source of the data being displayed, it's just a front end.
One way to more efficiently scrape data is to get to the data's source. In the case of Yahoo Finance, the data displayed on a web page comes from a JavaScript variable that is perfectly accessible to the end user, and much easier to parse and work with. Another way is to go one level lower, and retrieve JSON-formatted data from the same place that the front-end web page does; ignoring the front end altogether and essentially treating it as an unofficial API. Either way is not only easier than parsing the end result, but faster and more reliable, to boot.
How does one find these resources? [Doug] gives some great tips on how exactly to do so, including how to use a web browser's developer tools to ferret out XHR requests. These methods won't work for everything, but they are definitely worth looking into to see if they are an option. Another resource to keep in mind is woob (web outside of browsers), which has an impressive list of back ends available for reading and interacting with web content. So if you need data for your program, but it's on a web page? Don't let that stop you!
What do you do when the website frontend of list of outlet products in your local electronics store is impossible to use?
Right, you write your own #Python script that scrapes the data via requests to the #API the #ajax / #xhr calls use.
(Webshop in question was loading products page by page, and only then filters the results by your selected local store... meaning you often get only 1 or 2 results added, before you have to trigger the infinite scroll again...)
le film interactif de #blackmirror au nom imprononçable et qui ressemble a celui de Bénédict sumperbatch t'a impressionné ?
ben ce n'est rien a côté de ce jeu de l'enseignant qui débarque dans une classe de kassoss fait en #angular sur un script de chez nioutaik. (c'est un des trucs que je demande de recréer aux gens que je forme sur cette technologie web)
enjaillez !
#herogame #jeu #game #online #js #web #interactive #xhr #json #css