How can I parse a link within locally stored html using python? - html

I am trying to extract text from a link within an html file that is locally stored. The link is as follows:
file:///Users/my_name/Dropbox/folder_name/wisenews/18Jan2021%20(1).html#body.202003310521728.1
I can't seem to use open() to access this link. I tried the following but does not work.
open(file:///Users/my_name/Dropbox/folder_name/wisenews/18Jan2021%20(1).html#body.202003310521728.1)
How can I access this link?
I added screenshots of jupyter notebook for more elaboration

You have to pass the actual file path to the function
Should be something like:
open("C:/Users/Users/my_name/Dropbox/folder_name/wisenews/18Jan2021%20(1).html")

Related

open HTML from PowerShell with URL parameters

I am trying to open a HTML file in Microsoft Edge browser from PowerShell.
Below code opens HTML in Microsoft edge
&'C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe' #('d:\test.html')
How to pass some values from PowerShell to HTML using URL parameters.
I wanted something like below code
&'C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe' #('d:\test.html?testvalue1=45&testvalue2=50')
But the above code opens browser but cannot able to load test.html. Using JavaScript I want to get values from URL which is passed by PowerShell.
You could try the command below.
Start-Process microsoft-edge:"https://localhost?testvalue1=45&testvalue2=50"
Output:
One way to accomplish this is to use the "Start-Process" cmdlet
Start-Process 'C:\Program Files (x86)\Mozilla Firefox\firefox.exe' C:\Web\index.html
This however only works if you know the path. For some reason Powershell fails to translate for example .\index.html to a proper path.

HTML Excel Link Can't Find File?

I'm using this string before a pathway to a local excel document:
ms-excel:ofe|u|
The filepath looks like something like this "Y:/My Files/Organization/This Folder/
When clicking on the rendered link, Excel launches but I get the "Sorry, can't find file" alert which displays the failed path, wherein each space and back-slash are replaced with %20
Am I using that aforementioned ms-excel string correctly?
Thanks!
ms-excel:ofe|u|file:///${batchPath}
The missing bit was file:/// along that string. With that, the locally saved filepaths launched without issue!

Swift: Access files in Documents Dictionary from webpage stored in Main Bundle

I'm loading an HTML webpage from the main bundle in my Swift iOS app, which is working perfectly well. However, I'd like to reference a file stored in the documents dictionary from the HTML webpage. I can't quite figure how to cross reference between the Documents and Main Bundle locations. Is there a way to do this? Thanks!
I think you instead of open url directly to webview you need to download contain of url and convert it to string which gave you html string.
than replace a path with your local path to that html string.
Open modified html string to webview.
hope this will help you.

IrfanView generate HTML file from Thumbnails in cmd

I try generate from IrfanView cmd interface HTML page from directory with Thumbnails, but I can't find any parameter or options, how I can do it.
I can generate Thumbnails via:
"C:\Program Files (x86)\IrfanView\i_view32.exe" "C:\Test\FullScreens\*.jpg" /resize=(100,100) /aspectratio /resample /convert="C:\Test\*.png
I can't find this in cmd:
It is possible to realize this?
Thank you, Regards,
  Peter
The text file i_options.txt in program files folder of IrfanView contains all options which can be used on command line. There is no option to create an HTML file. This must be done via GUI using the captured dialog.
But after creating the thumbnails for the images, it would be of course possible to create with a batch file also the HTML file using the commands echo, for, if and set with output created by several echo command lines redirected to the HTML file to create. Executing in a command prompt window help echo, help for, ... displays help on those internal commands of command interpreter cmd.
However, it would be a lot of work to create a batch file with all the parameters of the dialog. And it would make the batch file slower to really support all those parameters. A tailor-made batch file for creating the HTML file exactly like you want them would be much easier to code.
I suggest to try by yourself coding the batch file to create the HTML file. Create a new question with a link to this question, if you have somewhere a problem which you can't solve by yourself. Post in this question the batch code you have so far and the content of the HTML file created by IrfanView which should be instead created by the batch file.

read and write a text file locally using chromium

I am running a web application from a local folder using Chromium.
Let's say I have my application contained in the following folder:
C:/Myfolder/App
I also know how to read a text file using the HTML5 APIs using a
<input type="file" name="files" id="fileElem" />
now I would like to know if I can read the file without the user having to select the file I am trying to read. The file is always contained in the following folder:
C:/Myfolder/App/Files
a subfolder of the folder containing the HTML that defines my application so there will not be any security restrictions and the file is always run through chromium locally. The file I am trying to read is a text file. Can I also modify and write the file in the same location? If yes would you be so kind to provide some example code?
Thank you very much,
Set TChromium.Options.FileAccessFromFileUrls to STATE_ENABLED and then you can use your normal AJAX functions on file://-Urls.
If you are using jQuery, you could use this code:
$.get('file:///c:/Myfolder/App/files/content.xml',function(data){
console.log(data);
})