S
S
Sergey2015-02-19 17:11:45
HTML
Sergey, 2015-02-19 17:11:45

Combine multiple html into one file. as?

Tell me how to implement?
There are multiple html files with full markup

<html>
<head>
<title>new page</title>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body><table><tr><td><div>контент</div></td></tr></table>

there are a lot of such files, there is also a lot of content inside them, I also
want to take content from all files and, with the union of tables, put it into one common one
, in fact, it is a log processor, a parser, but I have never done this before.
I hope I clearly explained what is required, if someone implemented this, please tell me how
ps the result of the union can be any file (xlsx, html, php, pdf, etc.) it doesn’t matter at all

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
M-ka, 2015-02-19
@M-ka

You posted this question in the wrong section.
If you do this, but from the described it turns out that the files are stored with you, and not loaded in the browser, then only in some kind of script that can work on the client (we are not talking about the browser).
Set the script on your computer to a folder with content, or feed the archive.
In the process of bypassing all files (maybe even a given format) from a folder / folders / archives, pull out the content from the body and export it in the desired format to the desired file or to the desired script.
You can try to sketch a bash script, but I just don’t remember in the syntax what about searching for content in files, is there such a thing. You can also try to write a script in Ruby, PHP or some other programming language. Although let's say if you pass through the nodges, then you can write in Javascript.
Although, let's say, if the files are not stored by the user, but there is a set of links, then you can already consider writing purely in Javascript (provided that you can post the result somewhere). Make an array of links, bypassing which in turn open a new window, pull out content from it, save it in an object, and then send it all somewhere ... I’ll note what exactly to send, because. javascript is not able to work with files from the user due to security restrictions. It can only in local storage, something to try to save, and then only in ff / chrome. Although IE used to have a vulnerability (presented as a browser chip) that allows you to create a file for the user, open a file, create a data stream to it, write a stream in a file, close the file, but fixes were released that stopped the ability to create data streams to files and subsequent record.
In general, initially for such purposes (when I had to pull out some content from different sites periodically), I wrote an extension in chrome that taught me how to work with many links and update information. But as soon as most of the functionality was added and working (it only remained to add a launch by a timer or opening a specific tab, and not just by a button, but also selection rules for other resources), a similar thing was written in PHP and took less code it, than on the zhs extension, was put in crowns and lived its own life for the time being ...

I
Igor Kalashnikov, 2015-02-20
@zo0m

I have not encountered such a problem, but how would I do it.
I would write a simple parser for this case in some favorite language: Java / JS (they gave you an example on Node.js above), and would pull it with cron or some other scheduler.
The parser would go through the folder, parse everything between the body / head tags and paste it to the end of the resulting file.
A more perverted option:
If your data is stored in a certain format or formats, and you can parse the files into some structure, and then draw a beautiful output on this structure at the end (this is IMHO the coolest case).
You can even tie sqlite to this case, let it add everything there before outputting, and then it processes and you can collect statistics, such as how many Exceptions fell out or some other garbage and graphics to figure out, and filters are different. But it already depends on the volume of logs, of course :) and your interest.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question