Dynamically loaded content scraping - java

I'm trying to create simple site scraper using Java and jsoup or htmlunit.
I have chosen vk.com as a target site.
My goal is to go through the audio tracks and download them. I started investigation and figured out that there is no URL of tracks in DOM. Track is somehow dynamically downloaded after pressing "play" button.
My question is: how can I capture dynamically loaded file?

Related

How to share file between apps without file section interface

I am trying to make an app that can easily keep sending files to different apps(whichever the user is running currently), when those apps make request to my app for files.
I was going through this link Sharing a file in Android , Sharing simple data in android and also Sharecompat Blog.
In these links they use a chooser interface to select target apps which I don't want.
My goal is that those other apps can communicate with my app without any clicks or selection.
And In response I can provide them the necessary files.
But I couldn't find anything which can help me build my desired app.
How Can I do it?
Please, Any suggesstions.

How to display HTML on EditText?

I am trying to make an Android Application, it is intended to be a notes app, similar to Evernote.
For the ones that have used Evernote (or every other good notes app) you may already know that it allows users to not only save text, but to add images, files, and other formatting features too.
So I came up with the idea of using HTML so the user can attach images and have different text styles (bold, regular, italics, etc...).
The user would select an Image of his files, and the HTML should show it in the EditText itself. Same thing with the Text Style.
Is it possible to achieve this? Would I need to use a library?
EDIT
I followed Lena's answer, and it works fine, but the main problem now is that it does not displays the images properly, whether they are from Internet or from the sd card. I do have Internet permission available and the Write/Read external storage too.
This is my code:
Edit.setText(Html.fromHtml("<strong>IT IS STRONG</strong>" +
"<p>Tiptoe</p>" +
"<img src=\"/sdcard/Pictures/Screenshots/Screenshot_20200204-230814.png\"/>"));
editText.setText(Html.fromHtml(yourHtmlText))

How to check if video is playing if we have video URL?

I am writing a java class where i have some video URLs . I want to check if the video is played or not . In other words i just need to validate the video URL
I have heard we can use Selenium for this but i have no idea.
Thanks in Advance
If your video is playing using html5 tag and are using selenium then you can check that as following:
driver.findElement(by.xpath("Video element")).getAttribute("currentTime");
if it is greater than 0 that means those many seconds of playback o/w:
driver.findElement(by.xpath("Video element")).getAttribute("ended");
will show if playback has ended.
Selenium is a web driver that works by inspecting the DOM and interacting with the browser so I am assuming your java class ends up generating a web page.
I've never tried to interact with a video player before but assuming you are using html5 for your player you should be able to play the video by getting the play button element from the page and actioning a click on it. To verify that it actually plays you could wait a few seconds then verify via the progress bar that the current point in the video is past the 0:00 moment.
The above said, if these videos are external URLs you should avoid testing them, your testing should refrain to what is within the scope of your application, IE check that a video player is on the page, and confirm that it points at the expected link, but not that external resources are available (IE that a random video is still available on YouTube).

JavaFX :Open Acrobat Pdf Reader Inside JavaFX Frame

I'm new in JavaFX FrameWork.I want to Create a Frame that will open Pdf File inside the Frame.
My Question is,
Is there any way to open Desktop App Inside JavaFx Frame?
I'm new in JavaFX FrameWork.
I'm just starting from this place
Edit:
I know how to create Frame Using JavaFx .
Ref Link.
But I want to run a desktop Applications inside of it like Acrobat Reader.
Can anyone please explain this is possible or not?
Am I searching for a wrong thing for a long time? Please Explain me if it is possible or not.
I do not believe there is integrated PDF supported into either Java or JavaFX. There are however a number of external libraries such as jpedal that provide embeddable java components for the viewing of pdf documents. You should be able to embed this node within the javafx frame.
An alternative solution would be to parse the pdf file into something you can display in your jframe.
Another solution can be found here which even includes a simple guide on setup.
Another quick search revealed an open source solution:
maven-OpenViewerFX-src
Watch the youtube video here
A somewhat hackable workaround, if you want no external Java libraries
It is possible to display the PDF in the web viewer by utilizing pdf.js, See this website for the entire details . But in short it involves rendering the PDF in a webview component. You could then embed the webview component in your Jframe.

Use blackberry camera in java app to select a photo that was already on file

I know you can use
Invoke.invokeApplication(Invoke.APP_TYPE_CAMERA, null);
to get the blackberry camera application to be shown and allow the user to take photos. From which you can use a FileJournalListener to find any created files.
(As shown/implied in this forum post: http://supportforums.blackberry.com/t5/Java-Development/How-to-use-FileJournalListener/td-p/295424)
There are times however, when the user chooses not to take a photo but selects one from the file system. Since this wasn't created at the time I opened it, using the FileJournalListener is not going to meet my needs.
What should I use to get the selected file?
EDIT: The functionality I'm trying to produce I've seen in the Twitter for blackberry application
I think you should create a file picker first,
http://docs.blackberry.com/en/developers/deliverables/11958/Create_a_file_picker_856986_11.jsp
After that in the application, user could select whether to capture new picture or browse from their storage.
If user select the later, open up this file picker and for every images found user can view the image, and the application can save the path where the images located for further processing.

Categories