I'm working on a Python program to get the images from a Chinese manga/comic site. The page I'm stuck on right now is this page.
If I use a browser to open this page, on the link "右键另存此图片", I can get the image URL, which is image URL. However, I believe this part is generated by a piece of javascript code, so when I use BeautifulSoup to parse the HTML source code, the image URL is not there.
So my question is how can I get the final HTML after executing that javascript to get the image URL?
Related
Basically at work we are trying to speed up our website search results page and I wrote some unit tests to test the webpage automatically in JavaScript (Json) now I want to get the specific element IDs that I want to test for from the webpage source code so how do I get the webpage to display raw data without XML or anything? which I can then format and read using plugins such as Json viewer for chrome. The lead developer quickly showed me a way where he typed something in the URL bar of the web browser along with the URL and the webpage rendered and the entire webpage went into white background with black un-formatted lines of code so how do I do that?
I am fetching the HTML code from some external API. On my website, I want to create an anchor, which will open a new tab showing that HTML code parsed. How can I do that?
One way I know of is to just make an iframe, and show the code there, but that won't open a new tab and won't adjust the size easily.
What's the best way to solve this? I am using node.js express as a website's server.
you could use window.open("your url here") javascript function. You could just use an onclick attribute to call it like below:
<span onclick='window.open("your url here")'>view</span>
after which you could replace contents of a tag (lets say the body tag) with the html code received from the external API with standard javascript
I have an application that loads an image - the URL of the image however is dynamically generated.
The image URL would look like this (I get the image name through their API):
http://openweathermap.org/img/w/10d.png
That URL is created in javascript - how would I make javascript actually get the image from that URL and return the .png so I could display it?
Would ajax be best for this? The solution would have be in regular javascript as the application displaying the image only allows for basic javascript.
Edit: This is for a digital signage solution - so I need to get the .png file into javascript where I will return ThePicture so the signage can display it appropriately. So unfortunately, just adding it to the/a DOM won't work.
How to save HTML div or table data into PDF at desired location using JavaScript or PHP?
I just Googled the exact title to your question - How to save html div or table data into pdf at desired location using javascript or php - and this popped right up: Php : create pdf from html using mpdf.
It tells about mPDF, which is an PHP Library that parses HTML/CSS to generate PDF files. Looks like it's just what you need.
A little research before throwing googlable questions saves everybody's time. Next time, please refer to the help section to learn how to ask a good question.
I have created a graphics using jquery. and i want to convert this web page to pdf or an image. Which one is simpler? but when I convert this page to pdf that graphic will not shows. can any help me to solve this problem??? please refer some code.
JavaScript is interpreted by the browser, not by the HTML -> PDF application. I'd recommend using wkhtmltopdf, as it uses Webkit to render, so maybe that would fix your problem.
To try to render the page that includes JavaScript, fire up Google Chrome (or another browser with a DOM Inspector of sorts), open your webpage, right click and select Inspect Element, right click , click Edit as HTML, and copy & paste the HTML into a new text document, save it, and use that instead to convert to a graphics.
You have to go through a complicated process like this because that application that your are using renders only HTML + CSS, and doesn't even parse the JS. The DOM inspector shows the HTML pages as it currently looks, not when it was loaded.
I hope I didn't make it too complicated...