Getting full page source information using PowerShell - javascript

So my ultimate problem is that I have a SharePoint list where each list item may have multiple image attachments. I am looking to scrape the list using PowerShell so that I can backup all the images.
I am able to access each item's page in the list because of similarities in the URL, but I am unable to extract the attachments. This is because the filename is non-determinant. Unfortunately, I don't seem to be able to parse the info with Invoke-WebRequest because it brings back the HTML of the page, which does not list the file attachments.
Instead, the file attachments can be viewed when you use the 'Inspect page source' button, and which I believe is because they are inside a JavaScript function.
So, my question is - Can I get each file in a page's attachment from the JavaScript function so that I can scrape the page? Also - am I interpreting this problem correctly, and are there any other ways to solve this problem?
Please note: I don't have access to SharePoint server dlls including Microsoft.Sharepoint.dll, so I can't use Classes from that dll (unless they might be easily imported without having to install the whole library).
Here is a photo of where the source changes. I believe this is where HTML ends and Javascript begins:
And the highlighted lines in this file shows the information that I am looking to parse from the page's source information so that I can form the URL to download the image attachments:

Related

How to Auto Upload a json file to my github Website

There is a program in my company that generates a JSON file. I created a website (that will be live on github pages) using java script and html that displays the information from this JSON. Now I want others in my company to generate individual JSON files and be able to upload them to this website by clicking a single button. I'm thinking the button they click would generate the JSON (let's say it saves automatically as c:data.json), programmatically open the github pages website and then programmatically upload c:data.json. I do not want the json file to be stored on the website, just uploaded for one time use.
I have done a couple google searches and can only seem to find stuff on how to upload a json file in your code which I am already doing locally. I need a local file to programmatically upload, in order to be used in a github pages website. I'm new to web dev and any help is appreciated :)
OS: Windows 10
developed using: node.js, javascript, html, json, github pages.

Modifying local files embedded in a Google Chrome Extension using JS

I have been doing a lot of research and have been unable to find an answer to my exact question. I understand that having a google chrome extension that can write to local user files would be a major security breach and thankfully isn't possible. However in my extension is a .json file that is used to make a HTML webpage with links via JavaScript. The JS reads the .json file and inserts the lines of code on the html page. I am attempting to make a user interface that allows them to update and edit the .json file that is inside the extension in order to add new lines of code to the webpage, but have been unable to find anything that could make this work due to security issues. I was thinking that since the file is in the extension users should be able to modify it.
If that was confusing here is a flow of what I want to happen and where it is not working:
Works:
Users clicks on button that takes them to a webpage hosted in the extension -> when page is loaded, the javascript runs -> the JS looks at a .json file in the extension using an XMLHttpRequest, parses the data, and then inserts it into the html -> The user now see's the content that was contained in the .json file on the html page.
Doesn't work:
After this I would like to have an interface that will allow the user to edit this .json file in order to update the page as they see fit, all in the extension itself.
If it was just me using this extension I could simply use the chrome storage api's available, however this is for my team at work, who are wanting to make edits as we need. Which means we will all be editing the same .json file.
Any information regarding this would be very beneficial. Even if it's as simple as it can't be done. Either way manually editing the .json file without a simple UI is much easier than editing the html directly.
Thanks in advance!
Posts/Articles I have looked at regarding this question:
Access Local Files using a Google Chrome Extension
https://developer.chrome.com/extensions/storage
Local file access with javascript
Allow Google Chrome to use XMLHttpRequest to load a URL from a local file

How to manipulate a local text file from an HTML page

I've generated an HTML file that sits on my local disk, and which I can access through my browser. The HTML file is basically a list of links to external websites. The HTML file is generated from a local text file, which is itself a list of links to the remote sites.
When I click on one of the links in the HTML document, as well the browser loading the relevant site (in a new tab), I want to remove the site from the list of sites in the local text file.
I've looked at Javascript, Flask (Python), and CherryPy (Python), but I'm not sure these are valid solutions.
Could someone advise on where I should look next? I'd prefer to do this with Python somehow - because it's what I'm familar with - but I'm open to anything.
Note that I'm running on a Linux box.
First, Javascript cannot modify the local filesystem from the context of a webpage. To allow that would be a massive security concern.
Any server-side web framework can do this, and Flask is a great one to use because it's so lightweight. The general steps you would want to take are:
When / is requested, load the list of links.
Change each link to point to /goto?line=<line_number>.
Display the list to the user.
Then when you click a link:
When /goto is requested, load the list of links.
Remove the line number from the list.
Save the list of links.
Return status code 302, with the real URL as the Location header.
There is many ways to do this
Here is the easiest 3
Use JavaScript
2 install wampserver or similar and use php o modify the file
3 don't use te browser to delete and instead use a bat file to open the browser and remove the link from the text file

How to extract content from a given url's document using gwt?

I'm new to GWT and am trying to build a web scraping app.
I have a custom URL, say www.amazon.com.
I want to be able to open this url, scrape information from its source (preferably by storing the html content as a Document in gwt) and print the scraped info on the console.
I've tried creating an iframe in the current page and setting its src to the custom url. But that didn't work out.
Do tell me if you need me to elaborate / clarify any aspect of the question
Thanks!
Scrap the URL on the server and write the output through a servlet. Open this Servlet URL in a Dialog box in GWT.
Or if the content (of the scrapped page) can be stored in other formats like a HashMap, then you can RPC the server to get the data object and display it in an HTML panel at the client side.
Thanks,
Sreehari.

Load XML data into a KML file with JavaScript

I'm trying to load information from a .xml file (located in a .kmz archive) into the description of a placemark using javascript. The goal is to display the information from the .xml file in an html table in the description. I've gotten everything working, with the exception that I can't seem to access the .xml file from the .kml file. I'm trying to use an XMLHttpRequest() to load the file from the .kmz. It works just fine as an html file, but when i put the html/javascript into a description tag of the .kml, nothing loads at all.
Does anyone know if this is even possible to do? If so, how? If not, any other suggestions?
Thanks in advance for the help!
Is this using the Google Earth API? If so, note that script tags, amongst others, are stripped out by default. You can work around this if needed as described at https://developers.google.com/earth/documentation/balloons#getballoonhtmlunsafe
If this is KML being loaded into the Google Earth client, javascript is allowed (with the exception of things like alerts which bring up a browser dialog).
However it's quite possible, for example if you are loading a separate KMZ in your XHR request, amongst a variety of other reasons, that you're getting a cross domain error (basically because you'll be loading a local file with file:// versus http://). To test this, I would recommend hosting the XML on a server somewhere, and trying to see if that works.
If so, but it does not work locally, please paste a link to your KMZ, or at least paste your main KML within the KMZ, and the associated file structure within the KMZ.

Categories

Resources