Jquery to count words, img,videos and get duration?
Im doing a task that I need to go to a url with an article on it. Count words,img and videos in the main article only. PLUS get video duration. The article page is different every time so I need to first guess which tags are it.
I was thinking the logic would be. Find content between each tag. Whichever innerhtml has the most characters in it thats the main article. So count words,img,and videos between those 2 tags. get video duration-i dunno. Is all this even possible?
- <p>ABC</p>
- <p>ABCDEF</p>
- <p>ASŞLDKASDA</p>
- <p>asdlkajsdmmlksadma</p>
- <p>aslkdjasldkjsaldkjasdlaksjdlak</p>
- <div id="result"></div>
- ----------------------------------------------------------------
- var $most = $("p").first();
- $("p").each(function(){
- if($most != null && $(this).text().length > $most.text().length){
- $most = $(this);
- }
- });
- $most.addClass("longest");
JSFiddle
How can I use this to go through every tag? I tried using '*' and '*', 'body' but it changes css bg black for everything.